I'll throw out the basics and any assistance is very, very, very much appreciated!
Access 2003 on XP
On a form (frmMain) is an option group of check boxes (ReportFrame) from which a user can choose a specific report to generate. The user selects the report of choice then presses a comand button (CmdRunRpt). The command button runs using the code below:
Expand|Select|Wrap|Line Numbers
- Private Sub CmdRunRpt_Click()
- If ReportFrame = 1 Then DoCmd.OpenReport "Rpt 1", acViewPreview
- If ReportFrame = 2 Then DoCmd.OpenReport "Rpt 2", acViewPreview
- If ReportFrame = 3 Then DoCmd.OpenReport "Rpt 3", acViewPreview
- If ReportFrame = 4 Then DoCmd.OpenReport "Rpt 4", acViewPreview
- If ReportFrame = 5 Then DoCmd.OpenReport "Rpt 5", acViewPreview
- If ReportFrame = 6 Then DoCmd.OpenReport "Rpt 6", acViewPreview
- If ReportFrame = 7 Then DoCmd.OpenReport "Rpt 7", acViewPreview
- If ReportFrame = 8 Then DoCmd.OpenReport "Rpt 8", acViewPreview
- If ReportFrame = 9 Then DoCmd.OpenReport "Rpt 9", acViewPreview
- End Sub
On the criteria form (Search Start Detail), there are two command buttons: OK and CANCEL. Selecting OK gives the data to the query and generates the report - this works perfectly.
Here's the issue:
Selecting CANCEL should close the form and cancel the generation of any report (as there is no criteria to generate). When I click CANCEL, the form closes correctly but then there is an error message stating:
Expand|Select|Wrap|Line Numbers
- Run-time error '2501':
- The OpenReport action was canceled.
martin