Hello! I'm working on an archives database and I'm trying to make the user interface a little easier. I have a form that looks like this:
Some of the items in the database have over a hundred associated persons, and I want to make it a little easier for the archivists to find associated persons on the form to either edit their information or add page numbers. I've added the combo box on the subform header with the label "Search by last name:". What I would like it to do is go to the first record that matches the string in the combo box, just as if you searched the form using ctrl+f. After searching these forums for guidance, I've added this code to the combo box after update event:
Unfortunately it does sweet nothing. Anyone have any ideas?
If it's any help, the row source for cboRecordSearch is
SELECT Persons.FamilyName FROM Persons;
And the row source for cboNameSelect is
SELECT [FamilyName] & ", " & [GivenName] & " | " & [Position] & " | " & [CityOfResidence] AS FullName, Persons.PersonID FROM Persons ORDER BY [FamilyName] & ", " & [GivenName] & " | " & [Position] & " | " & [CityOfResidence];
Some of the items in the database have over a hundred associated persons, and I want to make it a little easier for the archivists to find associated persons on the form to either edit their information or add page numbers. I've added the combo box on the subform header with the label "Search by last name:". What I would like it to do is go to the first record that matches the string in the combo box, just as if you searched the form using ctrl+f. After searching these forums for guidance, I've added this code to the combo box after update event:
Code:
Private Sub cboRecordSearch_AfterUpdate()
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[cboNameSelect] = " & Str(Nz(Me![cboRecordSearch], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub
Unfortunately it does sweet nothing. Anyone have any ideas?
If it's any help, the row source for cboRecordSearch is
SELECT Persons.FamilyName FROM Persons;
And the row source for cboNameSelect is
SELECT [FamilyName] & ", " & [GivenName] & " | " & [Position] & " | " & [CityOfResidence] AS FullName, Persons.PersonID FROM Persons ORDER BY [FamilyName] & ", " & [GivenName] & " | " & [Position] & " | " & [CityOfResidence];