On a Main Form, which has several linked Subforms, I've created a ComboBox to search and display the selected record. I've been able to create this using the following code. PROBLEM: It will select the first record with the specific last name, but will not allow advancing to the next record with the same last name.
I'd like to create a 'normal' ComboBox, that will let you begin typing the last name (however, the list provides LastName, FirstName), and it will start to fill in the ComboBox selection for you. Then it will let you select anyone with the same LastName, not just the first person with that specific last name. I do not want to use a Filter. Can someone help? I'm new to this VBA coding, and I may have put the code in the wrong Event. Thank you so much for your suggestions.
Private Sub cboSearchByName_AfterUpdate()
' Find the record that matches the control.
Dim Rs As Object
Set Rs = Me.Recordset.Clone
Rs.FindFirst "[LastName] = '" & Me![cboSearchByName] & "'"
If Not Rs.EOF Then Me.Bookmark = Rs.Bookmark
End Sub
I'd like to create a 'normal' ComboBox, that will let you begin typing the last name (however, the list provides LastName, FirstName), and it will start to fill in the ComboBox selection for you. Then it will let you select anyone with the same LastName, not just the first person with that specific last name. I do not want to use a Filter. Can someone help? I'm new to this VBA coding, and I may have put the code in the wrong Event. Thank you so much for your suggestions.
Private Sub cboSearchByName_AfterUpdate()
' Find the record that matches the control.
Dim Rs As Object
Set Rs = Me.Recordset.Clone
Rs.FindFirst "[LastName] = '" & Me![cboSearchByName] & "'"
If Not Rs.EOF Then Me.Bookmark = Rs.Bookmark
End Sub