Report

G

Guest

I am currently having a problem where I am getting a second prompt from my
report's query, when I decide not to run a report(meaning I click the quit
button from my query parameter box.)


Here is the response I received from Marsh MVP, concerning my problem:

"Well, that might be a little clearer ;-)

If I've got the correct picture, the second prompt is coming
from the report's query (because the form is no longer
open). What you would need is for a way for the form to
tell the report that the user quit the form so the report
can cancel itself. Your original form will then get an
error saying the operation was canceled, which you can use
code to trap and ignore.

IMO, you are going the long way around to filter the report.
The report should not be aware of the filtering operation,
instead the report's menu form should be in charge of
gathering the filter's criteria and apply it using the
OpenReport method's WhereCondition argument. This way,
neither the report's query nor the report itself have
anything to do with all this stuff.)"


My question is how do I use the report's menu to gather the filter's
criteria for my reports. Meaning, under which event in my report's menu,
will I call each individual report, and also gather the filter's criteria. I
have three reports that I will be calling.

Refer to the Strange Problem Reports Post - 07/25/2006
 
G

Guest

I have solved half of my problem by inserting the DoCmd.Close line in the
close event of my query parameter form. My problem now is that since I have
a preview checkbox in my Reports Menu, I do not have the option of the
cancelling the option to run my report. Meaning when my parameter form is
displayed, it has a quit button, when I click the quit button - I get the
following error message.
Run-time error '2501' The Close action ws cancelled.

Here is the code from the Open button on my reports Menu:
Private Sub cmdOpenReport_Click()
' Purpose: Opens the report selected in the list box.
On Error GoTo cmdOpenReport_ClickErr
If Not IsNull(Me.QCReports) Then
DoCmd.OpenReport Me.QCReports, IIf(Me.chkPreview.Value, acPreview,
acViewNormal)
End If
Exit Sub

cmdOpenReport_ClickErr:
Select Case Err.Number
Case 2501 'Cancelled by User, or by NoData Event.
MsgBox "Report Cancelled, or no matcing data.", vbInformation,
"Information"
Case Else
MsgBox "Error " & Err & ": " & Error$, vbInformation,
"cmdOpenReport_Click()"
End Select
Resume Next
End Sub

The Close event of all my query parameter forms just has the following line
DoCmd.Close

Is this a situation where I have to trap my errors ?



IMO, you are going the long way around to filter the report.
The report should not be aware of the filtering operation,
instead the report's menu form should be in charge of
gathering the filter's criteria and apply it using the
OpenReport method's WhereCondition argument. This way,
neither the report's query nor the report itself have
anything to do with all this stuff.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top