Macro question regarding msgbox's

  • Thread starter Thread starter ryan.fitzpatrick3
  • Start date Start date
R

ryan.fitzpatrick3

I created a macro that looks like this

SetWarning = No
Hourglass = Yes
OpenQuery
OpenQuery
Msgbox = Query1 has pulled
OpenQuery
OpenQuery
Msgbox = Query2 has pulled
OpenQuery
OpenQuery
Msgbox = Query3 has pulled
HourGlass = No
SetWarnings = Yes

Now this works perfectly except on the msgbox I want it to state that
"query1 has pulled" and continue on with the rest of the macro instead
of clicking "OK". I just want the message to appear for a view secs
then move on and not sit on the msgbox prompt waiting for someone to
click ok. Is this possible to do?

Ryan
 
If you have a form that is open while the macro is open, you can use the
SetValue action to put a message in a text box on the form.
Replace your MsgBox actions with a SetValue Action.
In the Item box, put the fully qualified name of the form and control like
[Forms]![FormName]![TextBoxName]

In the Expression box put the message in quotes:
"Query1 has pulled"

Now, if you don't have a form open at the time, you could create a small
form just for this purpose. Then at the beginning of the macro use the
OpenForm action to open the form and the Close action at the end of the macro
to close the form.
 
On Thu, 19 Jun 2008 12:55:11 -0700 (PDT),
So there is nothing that can display the info I want without the OK
button?

Instead of using MsgBox use an unbound form.
Then use the OpenForm macro to open this form instead of the MsgBox.

Create a new form. Include a label with whatever text you wish to
display.

Set the Form's Timer Interval property to
1000

Open the form's code window. code as below...

Option Compare Database
Option Explicit
Dim Aclock As Date

Private Sub Form_Load()
LabelName.Caption = "Query 1 has run."
Aclock = Time()
End Sub

Private Sub Form_Timer()
If DateDiff("s", Aclock, Time()) = 2 Then
DoCmd.Close acForm, Me.Name
End If
End Sub

The above form will display for a couple of seconds and then close
itself.
 
Back
Top