From the sounds of things you want to be able to select a field in your
database in the combobox, type a value in an associated text box, click a
button and display all records that match that value.
Is this correct?
If so, it is actually fairly straight forward.
Say your form has 3 controls:
a combobox called ctlSearchField
a textbox called ctlSearchText
a command button called btnGO
To filter the form so it will only display records that match the criteria,
you should attach an event procedure to the btnGO object:
Private Sub btnGO_Click()
Dim strSearchField As String
Dim strSeachText As String
strSearchField = Me.ctlSearchField
strsearchtext = Me.ctlSearchText
If strSearchField = "" Or strsearchtext = "" Then Exit Sub
Me.Filter = "[" & strSearchField & "] = '" & strsearchtext & "'"
Me.FilterOn
End Sub
However, this will only filter the form, you will still have to scroll
through each record using form navigation.
An alternative to above would be to include a listbox which is populated
via your search.
In this instance, say your form has 4 controls:
a combobox called ctlSearchField
a textbox called ctlSearchText
a command button called btnGO
a listbox called ctlSearchResults
Private Sub btnGO_Click()
Dim strSearchField As String
Dim strSeachText As String
Dim strSearchSQL as string
strSearchField = Me.ctlSearchField
strsearchtext = Me.ctlSearchText
'If either search control is empty then exit
If strSearchField = "" Or strsearchtext = "" Then Exit Sub
'Build SQL string
strSearchSQL = "SELECT * FROM [INSERT TABLE NAME HERE] WHERE " &_
strSearchField & " = '" & strSearchText & "';"
'Assign SQL to listbox
Me.ctlSearchResults.RowSource = strSearchSQL
End Sub
Obviously, all of this is based on the basic information you gave, and I
might be barking up the completely wrong tree....
Hope that helps
John