I used Combo boxes to control navigation, and I have 2 of them. ! does a search by compnay name, and the other does it by Order #
In the properties of the Combo, you select Table/Query for the Row Source Type and in the Row source, you have SELECT [Customers].[CustomerID], [Customers].[CompanyName] FROM Customers ORDER BY [Customers].[CompanyName]; or somethign similar for your database, pointing to whichever table (Customers) and field on that table (Customer iD and CompnayName) you want to have displayed in the box. The ordered by means that the list displayed will be in alphabetical order.
Then, in the After Update filed of Properties, you insert [Event Procedure] and click on the ... box to the right of the text box, which will bring up your VB window. you need the proper coding which for my DB is:
Private Sub Combo30_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[CustomerID] = " & Str(Me![Combo30])
Me.Bookmark = rs.Bookmark
End Sub
and you need to make sure that the name of the combo box (Combo30 for me) matches the combo box you have.
For my OrderID search I have SELECT [Orders].[CustomerID], [Orders].[OrderID] FROM Orders ORDER BY [Orders].[OrderID]; in the Row Source
and
Private Sub Combo35_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[CustomerID] = " & Str(Me![Combo35])
Me.Bookmark = rs.Bookmark
End Sub
in VB
Hopefully this will give you an idea on how to search your own records!
