I am having trouble filtering one combo box on another. I found this very useful tutorial
http://www.databasedev.co.uk/filter_combo_boxes.html
I even downloaded the sample database, however I am having a very hard time implementing it on something else
Here is their code
Private Sub cboStore_AfterUpdate()
Dim sManagerSource As String
sManagerSource = "SELECT [tblManager].[lngManagerID], [tblManager].[lngStoreID], [tblManager].[strManagerName] " & _
"FROM tblManager " & _
"WHERE [lngStoreID] = " & Me.cboStore.Value
Me.cboManager.RowSource = sManagerSource
Me.cboManager.Requery
End Sub
cboStore Row source SELECT [tblStore].[lngStoreID], [tblStore].[strStoreName] FROM tblStore;
cboManager Row source SELECT [tblManager].[lngManagerID], [tblManager].[lngStoreID], [tblManager].[strManagerName] FROM tblManager;
Here is my code
Private Sub cboFirstName_AfterUpdate()
Dim sLastSource As String
sLastSource = "SELECT [contactsT].[ID], [contactsT].[first_name], [contactsT].[last_name] " & _
"FROM contactsT " & _
"WHERE [first_name] = " & Me.cboFirstName.Value
Me.cboLastName.RowSource = sLastSource
Me.cboLastName.Requery
End Sub
Basically I have a contacts table with ID, first_name, and last_name and combo boxes cboFirstName and cboLastName
cboFirstName Row source SELECT [contactsT].[ID], [contactsT].[first_name] FROM contactsT;
cboLastName Row source SELECT contactsT.ID, contactsT.first_name, contactsT.last_name FROM contactsT;
I am completely flummoxed as to why this isn't working. Does anyone see something I am missing?