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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open A form with a filter to be applied to its subform

Status
Not open for further replies.

mystuff

Programmer
Apr 30, 2004
86
0
0
US
Hi,

I have a question that may be a bit confusing. Can anyone help me?

I have an unbound main form.

The subform is bound to a table. I would like to open the main form with a filter to be applied to the subform. Actually, the filter is really another table with a list of IDs. (Does a filter have to be a query? If so, I created a query listing the whole table.) So, I want the subform to show only the IDs in the filter table. Does this make sense?

I was trying to do it with this command:
"DoCmd.OpenForm stDocName, acNormal, "qryAssignView"

But this tries to apply the filter to the mainform. How do I get it applied to the subform?




 
In the open event (or Load Event) of the main form, you can define the Record Source of the subform. I believe that is what you are attempting to do. htwh,

Steve Medvid
"IT Consultant & Web Master"

Chester County, PA Residents
Please Show Your Support...
 
On the "onLoad" event, of the main Form, you can
either use the "recordsource" property of the subform,
or the "Filter" property of tyhe subform.

Private Sub Form_Load()
Me.sfrmTaxes.Form.Recordsource = "qryAssignView"

Or

Me.sfrmTaxes.Form.Filter = "txtName Like 'A*'"
Me.sfrmTaxes.Form.FilterOn = True
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top