Reputation: 109
I am trying restrict the records in combo box 2 (cboNames) based on the selection of combo box 1 (cboClass).
Combo box 1 and combo box 2 are both based on records in the same table, tblNames.
Combo box 1's row source is set too
SELECT [tblNames].[ChildID], [tblNames].[Class] FROM tblNames;
Combo box 2's row source is set too:
SELECT tblNames.ChildID, tblNames.[Full Name], tblNames.Class FROM tblNames WHERE (((tblNames.Class)=[Forms]![frmInsertNewRecord]![cboClass]));
I was under the impression this should work but it obviously inst. Combo box 2 is blank.
Can anybody identify what i am doing wrong?
Upvotes: 0
Views: 42
Reputation: 3020
Once the value of the first combo box changes, you need to refresh the recordset of the second one.
You need to either hit the refresh button (F5) or add the following code in the _AfterUpdate
event of the 1st box:
Private Sub cboClass_AfterUpdate()
Me.cboName.Requery
End Sub
Upvotes: 1