thefourthwall
IS-IT--Management
I made a combo box using the built-in wizard to "find a record on my form" based on the record selected in the drop-down list.
The list is based on employees' last names, and includes first name, mi, and a value called "tzs."
This method works well until I encounter multiple last names that are the same, like 'smith,' or 'parker' and the code picks only the first entry. If I click on the 2nd instance of 'parker' the form does not update from the 1st instance, but works fine on unique last names.
I never realized the built-in code wouldn't take this into account, and need help resolving. The row source is
and the VBA code on the control's After Update event is
Thanks for your help.
The list is based on employees' last names, and includes first name, mi, and a value called "tzs."
This method works well until I encounter multiple last names that are the same, like 'smith,' or 'parker' and the code picks only the first entry. If I click on the 2nd instance of 'parker' the form does not update from the 1st instance, but works fine on unique last names.
I never realized the built-in code wouldn't take this into account, and need help resolving. The row source is
Code:
SELECT qryEmployeeDevice.LAST_NAME, qryEmployeeDevice.FIRST_NAME, qryEmployeeDevice.MIDDLE_INITIAL, qryEmployeeDevice.TZS_CODE FROM qryEmployeeDevice ORDER BY qryEmployeeDevice.LAST_NAME, qryEmployeeDevice.FIRST_NAME;
Code:
Private Sub Combo88_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[LAST_NAME] = '" & Me![Combo88] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub
Thanks for your help.