Record filter for reports

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

Guest

I have a report based on a query that gives all the records. I now want to
do a report based on some criteria so I use Reports!RptName.Filter = criteria
and set the filter to on. I get an error saying that RptName is invalid. I
checked the spelling and it is correct. Don't understand.
 
Where is the code? In the report or code that opens the report?

FWIW, I have never used the Filter property of a report. I generally open
the report with a Where clause or have a criteria in the report's Record
Source.
 
In the code that opens the report.
MJ
Duane Hookom said:
Where is the code? In the report or code that opens the report?

FWIW, I have never used the Filter property of a report. I generally open
the report with a Where clause or have a criteria in the report's Record
Source.
 
Again, I don't like this solution of applying a filter in the On Open event
however, if the code is in the report, just use:

Me.Filter = ....
Me.FilterOn = True
 
Thanks Duane. Can I pass the filter criteria in a public variable from the
OnOpen to the report then when I open the report? Can I do a sort the same
way?

MJ
 
If you have a public variable, you don't need to pass it anywhere since it
is public. Allen Browne has several excellent report tips at his web site
http://allenbrowne.com/tips.html. One of these is the accepted method of
setting the sorting of a report at run time.
 
Back
Top