Hi all,
I have a couple of issues I need some direction on and I'm under a bit of a time crunch so I'm not above begging!
Here's some of the background info without going into excruciatingly boring detail, so hopefully it's enough to provide an idea of the general structure:
Reports are launched from a form which allows the user to select from a list of possible reports and either preview or print by clicking respective buttons. On each report's On Open event, another form is launched which allows the user to input or select various criteria to customize the report output. Upon clicking the OK button on the criteria form, a number of nested queries are built on the fly based on the criteria selected, yada, yada, yada, and the report is generated.
My question is this: if the the user selects a combination of criteria which produces no data, how do I get a)the report to cancel without running and b)the code to return control to the criteria selection form?
So far, I've tried using a message box which fires from the Report_NoData event. The message box runs correctly but after clicking OK, I get another Access-generated error message that says: "The report could not be viewed because an error occurred.The OpenReport action was canceled."
Note that opening the report is what launches the criteria selection form and not vice versa. I've seen code samples on how to handle this if the report is launched from the criteria form but not the way I have it set up.
Any suggestions would be greatly appreciated. Hopefully I've provided enough detail. If you need more, please let me know.
Thank you!
Anne
I have a couple of issues I need some direction on and I'm under a bit of a time crunch so I'm not above begging!
Reports are launched from a form which allows the user to select from a list of possible reports and either preview or print by clicking respective buttons. On each report's On Open event, another form is launched which allows the user to input or select various criteria to customize the report output. Upon clicking the OK button on the criteria form, a number of nested queries are built on the fly based on the criteria selected, yada, yada, yada, and the report is generated.
My question is this: if the the user selects a combination of criteria which produces no data, how do I get a)the report to cancel without running and b)the code to return control to the criteria selection form?
So far, I've tried using a message box which fires from the Report_NoData event. The message box runs correctly but after clicking OK, I get another Access-generated error message that says: "The report could not be viewed because an error occurred.The OpenReport action was canceled."
Note that opening the report is what launches the criteria selection form and not vice versa. I've seen code samples on how to handle this if the report is launched from the criteria form but not the way I have it set up.
Any suggestions would be greatly appreciated. Hopefully I've provided enough detail. If you need more, please let me know.
Thank you!
Anne