How to Pass Filter from Query to Report?

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
 
W

Wayne-I-M

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.
 
P

Paul

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
 
D

Dale Fye

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
 

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