Error handling when report cancelled

pablavo

Registered User.
Local time
Today, 04:45
Joined
Jun 28, 2007
Messages
189
Just a quick one.

I'm not usre how to handle the error when cancelling a report. so when I hit a control to bring up a report and say I cancel it before I put in any parameters for example I get the dialog box " runtime error" "OpenReport action was cancelled" etc.

Could anyone help me on how to handle this with VBA so that it's at least a more user friendly dialog box?

thanks
 
the teqnique is to have error trapping in the module that opens the report and to test that error number. set a breakpoint where the error is displayed and use the debugger to determine the err number. Then create a constant for that number

i.e
If err <> REPORT_CANCELLED then
...........
 
From the command button error handling simply put:


On Error Resume Next.

and delete the error handling at the end of the sub.


In the reports On_No_Data event put:


On Error GoTo Err_Report_NoData

MsgBox "There is no data for this report. Canceling report...", vbInformation, " MsgBox Title"
Cancel = True

Exit_Report_NoData:
Exit Sub

Err_Report_NoData:
MsgBox Err.Description, , " Msgbox Title"
Resume Exit_Report_NoData
 

Users who are viewing this thread

Back
Top Bottom