Report Problem with On No Data
Hi All,
My DB opens a report from another form which the user selects certain print options. I have set an On No Data event on the report which if opened displays a message box (advising user of no data)and then cancel event (which closes the form). This part works fine if i open the report directly. However my problem is i open this report from another form and i get a run time error after the "On No Data" event runs on the report itself. When i click on the debug the error goes to line "DoCmd.OpenReport stDocName, acViewNormal" on the form. The Error code is 2501 : The OpenReport action was cancelled.
My code On My Form to open the Report is as follows
If (Forms!frmSOBStatMenu!Frame3 = 2) And (Forms!frmSOBStatMenu!Frame4 = 1) Then
stDocName = "rptXtabClmsByYearSumm"
DoCmd.OpenReport stDocName, acViewNormal
Else
If (Forms!frmSOBStatMenu!Frame3 = 2) And (Forms!frmSOBStatMenu!Frame4 = 2) Then
stDocName = "rptXtabClmsByYearSumm"
DoCmd.OpenReport stDocName, acViewPreview
Now if the report has not data the OpenReport stDocName runs then the On No Data event runs from the report, i get the message box advising user of No Data, then because i dont want the report to open i cancel event from the On No Data, thats when i get the run time error.
Any Ideas
Thx in advance
Darren
|