Combo Box Filter

S

Stacey

Has anyone ever done this? I have a combo box cboemployid in a form called
employedit; when you select an item in the combo box it should filter all
records associated with cboemployid by account in in a subform called
subform1.....now where I get stuck is, I would like to filter through all the
records in subform1 with another combo box cboaccounts, so that I can see all
records associated by account? Any help is greatly appreciated.
 
K

Ken Snell \(MVP\)

Put cboemployid in the LinkMasterFields property of the subform control (the
control that holds the subform object), and put in the LinkChildFields
property the name of the field that holds the employeeid value in the
subform's RecordSource query. That will link the subform's records to the
value selected in the combo box.
 
K

Ken Snell \(MVP\)

I'd be inclined to add a combo box to the Form Header section of the combo
box that would allow you to select an account number. Then, add a WHERE
clause to the subform's RecordSource query that filters the recordset by
that combo box:

WHERE AccountNumberField = Forms!SubformName!ComboNameOnSubform OR
Forms!SubformName!ComboNameOnSubform Is Null


Then put a requery action on the AfterUpdate event of the subform's combo
box to always requery the subform after you make a selection.
--

Ken Snell
<MS ACCESS MVP>
 
K

Ken Snell \(MVP\)

No. The WHERE clause that I posted would be added to the query that is the
subform's RecordSource. The combo box in the subform's Form Header section
would have a Row Source query that returns the Account Numbers.
 
Top