search form

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
 
M

Marshall Barton

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top