jenntheblond
Registered User.
- Local time
- Today, 15:20
- Joined
- May 9, 2001
- Messages
- 15
I have a bunch of forms that when opened they each pop up a dialog box which requests report info. I want the user to be able to cancel (via a command button) if they wish. When I pull up the report from the database window, this works perfectly.
HOWEVER, when I try to do this via a centralized "report form" that I have made, the CancelEvent doesn't work.
Process goes like this:
Click a button on the "Report Central" form which opens the report. (docmd.open form)
OnOpen of report opens a dialog form.
Dialog form has some combo boxes and such for choosing, and then a CANCEL and a GO button.
When I hit cancel, i set a boolean variable called varcontinue to false and close the dialog box.
At this point, in the OnOpen event of the Report, i have this code:
If varcontinue = false then
docmd.cancelevent
exit sub
End If
For some reason, this doesn't work unless form is opened directly from the window. What can I do here? docmd.Setwarnings doesn't help because this problem is a run-time error (Error 2501: The OpenReport Action was Cancelled). Well, i KNOW the Openreport action was canceled, that was my intent! How can i solve this annoyance?
THanks!
HOWEVER, when I try to do this via a centralized "report form" that I have made, the CancelEvent doesn't work.
Process goes like this:
Click a button on the "Report Central" form which opens the report. (docmd.open form)
OnOpen of report opens a dialog form.
Dialog form has some combo boxes and such for choosing, and then a CANCEL and a GO button.
When I hit cancel, i set a boolean variable called varcontinue to false and close the dialog box.
At this point, in the OnOpen event of the Report, i have this code:
If varcontinue = false then
docmd.cancelevent
exit sub
End If
For some reason, this doesn't work unless form is opened directly from the window. What can I do here? docmd.Setwarnings doesn't help because this problem is a run-time error (Error 2501: The OpenReport Action was Cancelled). Well, i KNOW the Openreport action was canceled, that was my intent! How can i solve this annoyance?
THanks!