Problem with MsgBox Emulation

  • Thread starter Thread starter acx
  • Start date Start date
A

acx

Dear Group,

I have decided to emulate the MsgBox() function which is sometimes
insufficient for me. Unfortunately, I don't know how to interrupt the
run of code until a user presses some button on my "MsgBox form".

I have written the function called MyMsgBox() which opens the modal
form and should wait until some button is pressed. The function
MyMsgBox() should provide the ID of that button then.

But how should I interrupt the run of the function and wait for the
user's response?

Many thanks,
MikeX
 
Open the form in dialog mode, which you do in the DoCmd.OpenForm action:

DoCmd.OpenForm "Formname", , , , , acDialog

The arguments that you provide (or don't provide) in the OpenForm action
override the property settings in the form itself. So, even if you've set
the form's Modal property to Yes in the form's design view, the OpenForm
action will override that setting unless you open the form using the
acDialog value in the sixth argument.
 
Dear Group,

I have decided to emulate the MsgBox() function which is sometimes
insufficient for me. Unfortunately, I don't know how to interrupt the
run of code until a user presses some button on my "MsgBox form".

I have written the function called MyMsgBox() which opens the modal
form and should wait until some button is pressed. The function
MyMsgBox() should provide the ID of that button then.

But how should I interrupt the run of the function and wait for the
user's response?

Many thanks,
MikeX

Not a modal form, just a plain everyday unbound form.

DoCmd.OpenForm "YourMessageForm", , , , , acDialog

Operation stops until a command button on the form is pressed, either
closing or making the form not visible. If you make it not visible,
you can close it in the code that opens the form.
 
Back
Top