OA_Msg.bas 1.6 KB

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