J
jnewl
have a form where the user thru option buttons can select a specific report.
based on those options, certain queries are activated. have used the nodata
option on reports to generate a msgbox and cancel = true. the problem is that
after the message box displays, get a run time error of 2501 - open report
error. have searched the responses that have been posted on this site. tried
using those suggestions, but still have the same problem.
here is the code that selects the reports
If Forms![select ancillary group]![report category] = 4 Then
DoCmd.OpenQuery "qry select service request not created for reports"
If Forms![select ancillary group]![group var] = "facility" Then
stDocName = "facility service request"
DoCmd.OpenReport stDocName, acPreview
Else
stDocName = "ancillary and physician service request"
DoCmd.OpenReport stDocName, acPreview
End If
here is the nodata code on the report
Private Sub Report_NoData(Cancel As Integer)
MsgBox "NO DATA TO REPORT", , "ancillary and physician report"
Cancel = True
End Sub
once the cancel occurs, tries to open the report
what code can i insert to prevent this? thanks much for your help
based on those options, certain queries are activated. have used the nodata
option on reports to generate a msgbox and cancel = true. the problem is that
after the message box displays, get a run time error of 2501 - open report
error. have searched the responses that have been posted on this site. tried
using those suggestions, but still have the same problem.
here is the code that selects the reports
If Forms![select ancillary group]![report category] = 4 Then
DoCmd.OpenQuery "qry select service request not created for reports"
If Forms![select ancillary group]![group var] = "facility" Then
stDocName = "facility service request"
DoCmd.OpenReport stDocName, acPreview
Else
stDocName = "ancillary and physician service request"
DoCmd.OpenReport stDocName, acPreview
End If
here is the nodata code on the report
Private Sub Report_NoData(Cancel As Integer)
MsgBox "NO DATA TO REPORT", , "ancillary and physician report"
Cancel = True
End Sub
once the cancel occurs, tries to open the report
what code can i insert to prevent this? thanks much for your help