msgBox on Report Open!

Crash1hd

Registered CyberGeek
Local time
Today, 04:54
Joined
Jan 11, 2004
Messages
143
I want to have a report open and then after the report is open and viewable on the screen have a msgBox come up and say Print? with a yes/no choice so that the user doesnt have to click on the print button! I tried this


Private Sub Report_Open(Cancel As Integer)
Select Case MsgBox("Print?", vbYesNo, "Print?")
Case Is = vbYes
'MsgBox "Yes"
DoCmd.Printout
Case Is = vbNo
'MsgBox "No"
DoCmd.Close
End Select
End Sub

and

Private Sub Report_Page()
Select Case MsgBox("Print?", vbYesNo, "Print?")
Case Is = vbYes
'MsgBox "Yes"
'do nothing
Case Is = vbNo
'MsgBox "No"
DoCmd.Close
End Select
End Sub

to no avail they both have the msgbox open before the report is open!
 
Place the code in the OnTimer Event of the form

Form Properties > Events > OnTimer

Set Timer Interval to 600 and adjust as you feel

Form Properties > Events > TimerInterval

Or

Use a pop up form instead of a message box

######### Edited ###########

opps I must be tired thought I was in Forms not reports :o

You can still use form and make it look almost the same as a message box by hiding its control box etc
 
Last edited:

Users who are viewing this thread

Back
Top Bottom