Cascading Combo Boxes in Form and Subform

T

Tia

I've been trying to work the bugs out of a form that has an attached subform.
I have a combo box on the main form where the user can select from a list of
Law Firms. Based on the Law firm selected, I would like the user to be able
select related attorneys from a combo box on subform. I would like the user
to be able to only select those attorneys related to the Law Firm selected.
I am having a hard time figuring out how to make this work. Jeanette
Cunningham has given me great advice on this but I haven't been able to make
it work. Any suggestions on what I'm doing wrong?

This is what I have in the source row of the combo box on the subform:

SELECT Timekeepers.TimekeeperID, Timekeepers.Timekeeper FROM Timekeepers
WHERE (((Timekeepers.LawFirmID)=Parent!cboLawFirmID));
 
J

John W. Vinson

This is what I have in the source row of the combo box on the subform:

SELECT Timekeepers.TimekeeperID, Timekeepers.Timekeeper FROM Timekeepers
WHERE (((Timekeepers.LawFirmID)=Parent!cboLawFirmID));

You will also need one line of VBA code in cboLawFirmID's AfterUpdate event:

Private Sub cboLawFirmID_AfterUpdate()
Me!mysubformname.Form!comboboxname.Requery
End Sub

John W. Vinson [MVP]
 
J

John W. Vinson

I've been trying to work the bugs out of a form that has an attached subform.
I have a combo box on the main form where the user can select from a list of
Law Firms. Based on the Law firm selected, I would like the user to be able
select related attorneys from a combo box on subform. I would like the user
to be able to only select those attorneys related to the Law Firm selected.
I am having a hard time figuring out how to make this work. Jeanette
Cunningham has given me great advice on this but I haven't been able to make
it work. Any suggestions on what I'm doing wrong?

This is what I have in the source row of the combo box on the subform:

SELECT Timekeepers.TimekeeperID, Timekeepers.Timekeeper FROM Timekeepers
WHERE (((Timekeepers.LawFirmID)=Parent!cboLawFirmID));

ah... probably also the parent form's Current event needs the requery (as well
as the combo box's AfterUpdate event). Same code though.

John W. Vinson [MVP]
 

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

Top