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?
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.