Well this same problem was my biggest dilemma when I first started
Access at the beginnning of the summer. A lot of research, trial &
error, and dedication to tens of hours in front of the computer finally
got my problem solved. (I wish I had discovered Google groups before
=(...).
I think what you want is to locate a specific record based on criteria
that you type in (or any criteria that you want). You can do this with
a list box (lstSearch). Use the listbox wizard to create a listbox "To
find records on the form based on the value I select in the list box".
Make a text box to type into (txtSearch) Then you can make a command
button that you can click when you want to find specific records
(cmdSearch). If you are going to be searching by multiple criteria
(which you are I assume), then create a frame with several option
buttons inside with the labels describing the category to search by
(fmeSearchby). Now under the command button code, enter something like
this:
Private Sub cmdSearch_Click()
'1 if Searching by Field1, 2 if searching by Field2
Select Case [fmeSearchby]
Case 1:
[lstSearch].RowSource = "SELECT [Table1].[Field1],
[Table1].[Field2], [Table1].[Field3] FROM [Table1] WHERE
((([Table1].[Field1]) Like " & "'" & [txtSearch] & "'" & ")) ORDER BY
[Table1].[Field1];"
Case 2:
[lstSearch].RowSource = "SELECT [Table1].[Field2],
[Table1].[Field1], [Table1].[Field3] FROM [Table1] WHERE
((([Table1].[Field2]) Like " & "'" & [txtSearch] & "'" & ")) ORDER BY
[Table1].[Field2];"
End Select
End Sub
Just substitute out the "table1", "field1", etc and insert your field
names.
Hope this helps.
I know VBA somewhat well.