Opening report form different forms

E

EliotF

Hello all,

I'm trying to open a report that is dependent on an [enquiry_id] field as to
which record is displayed.
The report opens from two different forms.
The query running the report selects the [enquiry_id] corresponding to that
displayed in the form.
I am unable to find a way to run the query from either form without having
to duplicate the query and the report.

I have tried adding
nz(forms!frm_main.[enquiry_id],Forms!frm_order.[enquiry_id]) to the criteria
on the query but this presents me with a message box for
"forms!frm_main.enquiry_id" before it opens the from the other form.

Could anyone offer me any advice please?
 
J

Jeff L

Use a filter when opening the qeport.

Docmd.OpenReport "YourReportName", acViewPreview,,Me.Enquiry_ID

You would need that statement for both forms that open the report.
 
K

Klatuu

Don't do the filtering in the query.
Use the Where argument of the OpenReport method to do the filtering.
 
Top