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!

Set Filter Property on Subreport

Status
Not open for further replies.

Jason760

Technical User
Mar 28, 2002
5
US
I use this code to filter forms

If Chassis = "CV" Then
Me.Filter = "[Process Family] Like 'CV*'"
Else
Me.Filter = "[Process Family] Like 'A3*'"
End If
Me.FilterOn = True

But I can't get it to work on a SubReport.
Should it be the Filter property be set in the Main Report, and How should the code be different to filter the records.
 
You must apply the filter to the subreport itself. Unfortunately, with reports, it must be open in design view to set the filter property. For example:

DoCmd.OpenReport MySubReport, acDesign
If Chassis = "CV" Then
Me.Filter = "[Process Family] Like 'CV*'"
Else
Me.Filter = "[Process Family] Like 'A3*'"
End If
Me.FilterOn = True
DoCmd.Close acSaveYes

Double-check the exact syntax, but you get the idea.

Aaron
 
Thanks for your help!

I couldn't Figure out why access wouldn't let me set the filter. It's good to know how to do it now. thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top