Help With Combo Box Code

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

Guest

I have a form called frmOPmeds with a sub form on it called fsubOPmeds. on
frmOPmeds I have a combo box that I want to use to filter another combo box
on my sub form.

I'm not sure how to do this. Any help would be greatly appreciated.

Thanks, Rob
 
I have a form called frmOPmeds with a sub form on it called fsubOPmeds. on
frmOPmeds I have a combo box that I want to use to filter another combo box
on my sub form.

I'm not sure how to do this. Any help would be greatly appreciated.

Thanks, Rob

Set the second combo's Row Source to a query referencing

Forms![frmOPmeds]![comboboxname]

as a Criterion.

In the mainform combo box's AfterUpdate event, requery the subform combo:

Private Sub mainformcombo_AfterUpdate()
Me!fsubOPmeds.Form!subformcombo.Requery
End Sub

John W. Vinson [MVP]
 
RobUCSD said:
I have a form called frmOPmeds with a sub form on it called fsubOPmeds. on
frmOPmeds I have a combo box that I want to use to filter another combo box
on my sub form.


Use a criteria in the subform's combo box's row source
query. The reference to the main form's combo box would be
like : Forms!frmOPmeds.maincomboboxname

Be sure to remember to requery the subform combo box
whenever the main form combo box's value changes.
Me.fsubOPmeds.Form.subcomboboxname.Requery
 
Back
Top