Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

filter report at run time

Status
Not open for further replies.

joshuaguilty

Programmer
Apr 26, 2005
81
CA
If I want to filter a report, what event should I use?
1. "Report_Activate"
2. "Report_Open
3. Other event
My report name is "Report 123", my field name in the query is "Field_filter1", and last I have a global variable "gVariable1" to be applied to the filter.
Please provide answer in details.
Thank you.
 
If you're using the DoCmd.OpenReport to open your report, you can specify the filter there.

DoCmd.OpenReport "Report1", acViewPreview, , "[Field_filter1] = '" & gVariable1 & "'
 
Thank you.
If I want to filter a sub-report, do I follow the same procedure?
 
Your sub-report should be linked to the data on your main report. If it is linked properly, the data in your sub-report should correspond to the data in your main report.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top