search form

  • Thread starter Thread starter Ezekiël
  • Start date Start date
E

Ezekiël

Hi,

I was wondering how i could create a form to search records. I would like to
use an id and name textbox for the searching parameters.

How can i search records by typing in an id or a name in one of the boxes
and at the same time let the form show the corresponding records.

Greetings,

Zeke
 
Ezekiël said:
I was wondering how i could create a form to search records. I would like to
use an id and name textbox for the searching parameters.

How can i search records by typing in an id or a name in one of the boxes
and at the same time let the form show the corresponding records.


For a simple form (without subforms) you can probably get
away with using some code to set the form's Filter property.

Generally you would want to use a button control to allow
users to indicate that they have entered a new name or id
and want the form's displayed records to be (re)filtered.
The code behind the button would be something like:

If Not IsNull(Me.txtSearchName) Then
Me.Filter = "namefield = """ & Me.txtSearchName & """"
Me.FilterOn = True
ElseIf Not IsNull(Me.txtSearchID) Then
Me.Filter = "idfield = " & Me.txtSearchID
Me.FilterOn = True
Else
Me.Filter = ""
Me.FilterOn = False
End If
 
Back
Top