General discussion


MSGbox in Access 97 Macro

By daniel.reyes ·
I have a report that is run by enter the different clients and the dates. I want to add a macro that will ask me if I want to run the report again. In the Properties of the report form... in the "on Close" of the forms properties I told it I had a Macro (print1).

I then created a second macro... It asks in the Conditional field" Msgbox("what is the name"). I have two options in it. Rerun Print1 or quit.
It always quits.

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

MSGbox in Access 97 Macro

by Shanghai Sam In reply to MSGbox in Access 97 Macro

A good way to do this is to have a form to do your selections (clients, dates) and then a button to print the report.

When the user clicks the print report button, the report is printed with code like the following that is associated with the on click property of the button:

Dim intResponse As Integer
DoCmd.OpenReport "MyReport", acViewNormal
intResponse = MsgBox("Print report again", vbYesNo)
If intResponse = 6 Then
GoTo PrintAgain
End If

Note that the line starting with "intResponse" ends with "vbYesNo)".

This code will automatically print the report once, then it will ask if the user wants to print it again. It will continue asking about printing again until the user clicks on "No".

The problem with using a macro is that the report must first be closed before it can be opened again and you get into a loop type of situation.

Related Discussions

Related Forums