Problem with MsgBox Emulation

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
 
K

Ken Snell \(MVP\)

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.
 
F

fredg

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top