Log in

View Full Version : Update Combo box list from selection in combo box



hatched850
11-18-2009, 09:59 AM
I am trying to create a form that has 2 combo boxes and when I make a selection in one Combo box I want that one to limit what I can chose from in the second one. My example would be this.

Combo Box 1: Type one
Combo Box 2: Sub type one
Sub type two
Sub Type Three
or if

Combo Box 1: Type Two, then
Combo Box 2: Sub type Three
Sub type four
Sub Type Five


etc.

Can someone help?:help

hansup
11-18-2009, 10:49 AM
In the After Update event of Combo Box 1, add code to modify the RowSource of Combo Box 2.

If that suggestion is too vague, tell us about your current RowSource for Combo Box 2, and explain how it should vary based on the current selection in Combo Box 1.

hatched850
11-18-2009, 03:20 PM
Thanks for trying to help I got it.

The First Combo Box in the on update I put this

Private Sub Type_Combo_AfterUpdate()
Me.Sub_Combo.Requery
Me.Repaint
End Sub

and on the other one where the combo box info is I put this.

SELECT tbl_Sub_Type.SubDescrip, tbl_Sub_Type.Type
FROM tbl_Sub_Type
WHERE (((tbl_Sub_Type.Type)=[Forms]![frm_type]![type_Combo]));
Worked great!