View Full Version : msgBox on Report Open!


Crash1hd
03-01-2004, 09:53 PM
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!

=TB=
03-03-2004, 07:50 AM
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