Display, then Close MsgBox

G

Guest

I have a process that takes a while to complete. I want access to display a
MsgBox that says "Please wait while process completes . . .", and then
automatically close the MsgBox when the process completes, without the user
having to click a button (OK, Cancel, etc). How can I code this?
 
A

Allen Browne

Create a small unbound for that looks like a message box. You can pass the
message, display the form, finish your procedure and close the form.

Set the form's Popup property to Yes, but Modal property to No. This allows
it to float over other forms, but does not prevent the code from executing
(as a MsgBox does.)

Put a text box on the form, with control source of:
=[Form].[OpenArgs]
Save it with a name such as "fdlgMsgbox".

Then in your code:
DoCmd.OpenForm "fdlgMsgbox", OpenArgs:="Please wait"
'your long process here
DoCmd.Close acForm, "fdlgMsgbox"
 
G

Guest

The form appears on the screen, but doesn't have time to fully appear before
the process starts running. In other words, it only partically appears and
the message itself isn't displaying. Is there a simply "Pause" or "Wait"
function that I can invoke to give the form time to fully appear before the
process starts running?
 
A

Allen Browne

Try adding:
With FormsfdlgMsgbox
.Recalc
.Repaint
End With

If that still doesn't work, try:
DoEvents
after the Recalc, and before the Repaint.
 

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

Top