You could design one custom form and make it look like a message box. Have
a label for the prompt string and however many buttons you want. Program
the buttons to set a public variable to equal their caption when clicked,
and save the form (I called my test form "frmMyMessage"). Create a Sub in a
standard module that will open this form and set the label text, button text
and form caption to whatever you pass to the sub as arguments. Whenever you
want to use (and re-use) this form, just call the function with the
arguments you want to appear on the form. It might not be an elegant
solution, but it might give you some ideas. Here's some sample code for
each piece you need (what out for line-wrapping):
'*********frmMyMessage events for the three buttons*******
Option Compare Database
Option Explicit
Private Sub cmd1_Click()
strClicked = cmd1.Caption
DoCmd.Close acForm, Me.Name, acSaveNo
End Sub
Private Sub cmd2_Click()
strClicked = cmd2.Caption
DoCmd.Close acForm, Me.Name, acSaveNo
End Sub
Private Sub cmd3_Click()
strClicked = cmd3.Caption
DoCmd.Close acForm, Me.Name, acSaveNo
End Sub
'***********************
'*****Global Sub in a Standard Module*********
Option Compare Database
Option Explicit
Public strClicked As String
Function MyMessageBox(TheCaption As String, ThePrompt As String, _
Button1 As String, Button2 As String, Button3 As String)
DoCmd.OpenForm "frmMyMessage", acDesign, , , , acHidden
With Forms!frmMyMessage
.Caption = TheCaption
.lblPrompt.Caption = ThePrompt
.cmd1.Caption = Button1
.cmd2.Caption = Button2
.cmd3.Caption = Button3
End With
DoCmd.Close acForm, "frmMyMessage", acSaveYes
DoCmd.OpenForm "frmMyMessage", , , , , acDialog
MyMessageBox = strClicked
End Function
'*********************
'****Command button (for testing) on a form********
Private Sub Command1_Click()
Dim strCaption As String, strPrompt As String, strResult As String
strCaption = "Testing Only"
strPrompt = "Please select 'Ok' to continue, 'Close' to close, " _
& "or 'Ignore This' to do nothing"
strResult = MyMessageBox(strCaption, strPrompt, "Ok", "Close", "Ignore
This")
Select Case strResult
Case "Ok"
'whatever you want when 'Ok' is clicked
Case "Close"
'whatever you want when 'Close' is clicked
Case "Ignore This"
'whatever you want when 'Ignore This' is clicked
End Select
End Sub
'**********************