OA_Msg.bas 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. Option Compare Database
  2. Dim p_SilentMode As Boolean
  3. Public Sub activate_SilentMode()
  4. p_SilentMode = True
  5. End Sub
  6. Public Function SilentMode_activated() As Boolean
  7. SilentMode_activated = p_SilentMode
  8. End Function
  9. Public Function OA_MsgBox(ByVal msg As String, Optional ByVal buttons As Long, Optional title As String) As Integer
  10. If Not p_SilentMode Then
  11. OA_MsgBox = MsgBox(msg, buttons, title)
  12. Else
  13. logger "OA_MsgBox", "INFO", title & " - " & msg
  14. While buttons >= 16
  15. buttons = buttons - 16
  16. Wend
  17. Select Case buttons
  18. Case vbOKOnly
  19. OA_MsgBox = vbOK
  20. Case vbOKCancel
  21. OA_MsgBox = vbOK
  22. Case vbAbortRetryIgnore
  23. OA_MsgBox = vbIgnore
  24. Case vbYesNoCancel
  25. OA_MsgBox = vbYes
  26. Case vbYesNo
  27. OA_MsgBox = vbYes
  28. Case vbRetryCancel
  29. OA_MsgBox = vbCancel
  30. End Select
  31. logger "OA_MsgBox", "DEBUG", "Silent mode: OA_Msgbox returned " & OA_MsgBox
  32. End If
  33. End Function
  34. Public Function prompt_for_export_confirmation() As Boolean
  35. msg = "**** OPENACCESS EXPORT ****" & vbNewLine & _
  36. "You're going to export the following:" & vbNewLine & vbNewLine & _
  37. msg_list_to_export() & _
  38. ""
  39. prompt_for_export_confirmation = (OA_MsgBox(msg, vbOKCancel + vbExclamation, "Confirm") = vbOK)
  40. End Function
  41. Public Function prompt_for_import_confirmation() As Boolean
  42. msg = "**** OPENACCESS IMPORT ****" & vbNewLine & _
  43. "You're going to update " & UCase(CurrentProject.name) & " with the sources files" & vbNewLine & vbNewLine & _
  44. "WARNING: Any non exported work would be lost!"
  45. prompt_for_import_confirmation = (OA_MsgBox(msg, vbOKCancel + vbExclamation, "Confirm") = vbOK)
  46. End Function