Opening report form different forms

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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?
 
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.
 
Don't do the filtering in the query.
Use the Where argument of the OpenReport method to do the filtering.
 
Sorted!
Thank you very much!!

Quick Note: For anyone who reads this with the same problem I needed speech
marks around the where clause to make it work correctly.

Docmd.OpenReport "YourReportName", acViewPreview,, "[enquiry_id] =
Me.Enquiry_ID"
 
Back
Top