By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,483 Members | 1,449 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,483 IT Pros & Developers. It's quick & easy.

Open Report Action Canceled Error Message

P: n/a
I have reviewed the many postings on this topic and understand the
principle, but am not sure where in my case to apply trapping an error.
I have created a form to supply parameters to a report. I click on the
command button to open the report, the form opens as it should and the
parameters are entered. Upon clicking on "OK," the underlying query is
executed. It is at this point, the the error message appears. The
dialog box disappers as it should, the results from the query appear
(instead of the report) with the correct data, and the error message.
The error message also pops up if I hit "Cancel" from the dialog box.

The code to open the report and form is as follows:

Private Sub Report_Open(Cancel As Integer)
' Set public variable to true to indicate that the report
' is in the Open event
bInReportOpenEvent = True

' Open Pending Orders by CCR Dialog
DoCmd.OpenForm "Select Pending Orders", , , , , acDialog

' Cancel Report if User Clicked the Cancel Button
If IsLoaded("Select Pending Orders") = False Then Cancel = True

' Set public variable to false to indicate that the
' Open event is completed
bInReportOpenEvent = False
End Sub

Should the trap error code be here or associated with the command
buttons on the dialog box or the command button on the switchboard that
calls up the report?

As always, any suggestions would be appreciated.

Miguel

Jul 13 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Miguel wrote:
I have reviewed the many postings on this topic and understand the
principle, but am not sure where in my case to apply trapping an error.
I have created a form to supply parameters to a report. I click on the
command button to open the report, the form opens as it should and the
parameters are entered. Upon clicking on "OK," the underlying query is
executed. It is at this point, the the error message appears. The
dialog box disappers as it should, the results from the query appear
(instead of the report) with the correct data, and the error message.
The error message also pops up if I hit "Cancel" from the dialog box.

The code to open the report and form is as follows:

Private Sub Report_Open(Cancel As Integer)
' Set public variable to true to indicate that the report
' is in the Open event
bInReportOpenEvent = True

' Open Pending Orders by CCR Dialog
DoCmd.OpenForm "Select Pending Orders", , , , , acDialog

' Cancel Report if User Clicked the Cancel Button
If IsLoaded("Select Pending Orders") = False Then Cancel = True

' Set public variable to false to indicate that the
' Open event is completed
bInReportOpenEvent = False
End Sub

Should the trap error code be here or associated with the command
buttons on the dialog box or the command button on the switchboard that
calls up the report?
In the switchboard that called it most likely. If you are working with
a Access generated switchboard you may need to dig to find the problem.

But what the heck, why not create an error routine here. Under your sub
line enter
On Error goto Err_OpenReportError

Just above the End Sub enter
Exit_OpenReportError:
Exit Sub
Err_OpenReportError:
If err.Number <2501 then
msgbox err.number & " " & err.Description
Endif
Resume Exit_OpenReportError
>
As always, any suggestions would be appreciated.

Miguel
Jul 13 '06 #2

P: n/a
Thank you for the response. I will follow your suggestion and see what
happens.

Miguel
salad wrote:
Miguel wrote:
I have reviewed the many postings on this topic and understand the
principle, but am not sure where in my case to apply trapping an error.
I have created a form to supply parameters to a report. I click on the
command button to open the report, the form opens as it should and the
parameters are entered. Upon clicking on "OK," the underlying query is
executed. It is at this point, the the error message appears. The
dialog box disappers as it should, the results from the query appear
(instead of the report) with the correct data, and the error message.
The error message also pops up if I hit "Cancel" from the dialog box.

The code to open the report and form is as follows:

Private Sub Report_Open(Cancel As Integer)
' Set public variable to true to indicate that the report
' is in the Open event
bInReportOpenEvent = True

' Open Pending Orders by CCR Dialog
DoCmd.OpenForm "Select Pending Orders", , , , , acDialog

' Cancel Report if User Clicked the Cancel Button
If IsLoaded("Select Pending Orders") = False Then Cancel = True

' Set public variable to false to indicate that the
' Open event is completed
bInReportOpenEvent = False
End Sub

Should the trap error code be here or associated with the command
buttons on the dialog box or the command button on the switchboard that
calls up the report?

In the switchboard that called it most likely. If you are working with
a Access generated switchboard you may need to dig to find the problem.

But what the heck, why not create an error routine here. Under your sub
line enter
On Error goto Err_OpenReportError

Just above the End Sub enter
Exit_OpenReportError:
Exit Sub
Err_OpenReportError:
If err.Number <2501 then
msgbox err.number & " " & err.Description
Endif
Resume Exit_OpenReportError

As always, any suggestions would be appreciated.

Miguel
Jul 14 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.