Please let me know how to populate one combo box with the field from a table based on the value selected in another combo box. I have two combo boxes, one for States and another for counties ( which is a field in a table)
Please let me know how to populate the county combo box based on the State the user select from the dropdown.
I tried this, but does not work
Private Sub CboCounty_Change()
Dim Dbs As Database
Dim Rst As Recordset
Dim MyString As String
Set Dbs = CurrentDb()
MyString = "Select County from TblGeography where State='" & CboState & "'"
Set Rst= Dbs.OpenRecordset(MyString)
Me.CboCounty.RowSource = MyString
Me.CboCounty.Requery
End Sub
Thanks for your help.
Please let me know how to populate the county combo box based on the State the user select from the dropdown.
I tried this, but does not work
Private Sub CboCounty_Change()
Dim Dbs As Database
Dim Rst As Recordset
Dim MyString As String
Set Dbs = CurrentDb()
MyString = "Select County from TblGeography where State='" & CboState & "'"
Set Rst= Dbs.OpenRecordset(MyString)
Me.CboCounty.RowSource = MyString
Me.CboCounty.Requery
End Sub
Thanks for your help.