Help With Combo Box Code

R

RobUCSD

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
 
J

John W. Vinson

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]
 
M

Marshall Barton

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top