How to Pass Filter from Query to Report?

  • Thread starter Thread starter Paul
  • Start date Start date
P

Paul

Hello,

I would appreciate any help with this problem that's been
driving me nuts. I have a query of inventory items with
only a subset of fields from the complete inventory datasheet.
I have designed a report that will take the items from
the query and print tags.

Sometimes, I would like to print only a few tags. I apply a
filter to one of the columns in the query datasheet, but this
filter has no effect on the report. What can I do so that
when I apply a filter to the query, it will also be reflected
in the report?

I was thinking of putting a formula of some kind in the filter
property of the report that points to the query's filter property,
but everything that I tried did not work. :-(

Can anyone help me with this please?

Thank you,
Paul
 
Sounds strange. If the report is based (??) on the query it "should apply
the filter.

How are you printing the report - are you closeing the query 1st ?

Can you post the sql and also any button or form code related to this and
someone may be able to assist.
 
Hello,

Yes, the report is based on the query. But after I have
created the report, I apply different filters to the query
and would like to see this automatically reflected in the
report when I open it. I don't want to create and format
a new report (tag/label) for each filter that I apply to
the query.

Thank you very much for any help.

Paul
 
Paul,

The OpenReport method has a WhereCondition as a parameter. Try this (it
worked for me):

docmd.openreport "rptYourReportName", acViewPreview, ,
currentdb.QueryDefs("qryYourQueryName").Properties("Filter")

HTH
Dale
 
Back
Top