Filter records by code

G

Guest

There must be an easy way to do this but I just cant put my finger on it (or
find it here).

• I have a form (called FormSearch)
• Within the form header section is an unbound textbox (called txtSearch)
that I intend to use for the search criteria and a few labels headers...
Forename, Surname and Tel Nº.
• The form view is 'continuous' and contains txtSurname, txtForename and
txtTel, linked to a query that is just the same as the table except it puts
them in alphabetically order.

Contained within the 'change' event, i want to filter the records based on
the text in txtSearch.
I've played around with a few of the examples here and in Help but just cant
make it relate to MY situation.

Anyone point me in the right direction ??

Thanks in advance.
 
M

Marshall Barton

Widemonk said:
There must be an easy way to do this but I just cant put my finger on it (or
find it here).

• I have a form (called FormSearch)
• Within the form header section is an unbound textbox (called txtSearch)
that I intend to use for the search criteria and a few labels headers...
Forename, Surname and Tel Nº.
• The form view is 'continuous' and contains txtSurname, txtForename and
txtTel, linked to a query that is just the same as the table except it puts
them in alphabetically order.

Contained within the 'change' event, i want to filter the records based on
the text in txtSearch.


I'm not clear on what your situation is, but here's an air
code example:

Sub txtSearch_Change()
If Len(Me.txtSearch.Text) > 0 Then
Me.Filter = "Surname Like """ & Me.txtSearch.Text & "*"" "
Me.FilterOn = True
Else
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