Search on form using mulitple fields (1 Viewer)

iainmid

Registered User.
Local time
Today, 07:25
Joined
Mar 1, 2007
Messages
35
Hi

Im fairly new to access and am trying to find out how to create a form that searches a table using multiple fields.
I have Contacts table with the fields (Organisation, Address, Street, Town, Postcode, Telephone No, Main Activity, Secondary Activity).

I have created a Search form which i have four text boxes named (Organisation, Postcode, Main Activity, Secondary Activity) and a command button.

I want to be able to use this form to enter data into these text boxes and on click of the command button it matches with the data in the contacts table.

The problem im having is because i want the search to be able to work if some of the fields on the search form are null for example so i can do a search only with Organisation, Postcode and Main Activity.
Is this possible just using one command button?
 

MStef

Registered User.
Local time
Today, 07:25
Joined
Oct 28, 2004
Messages
2,251
Yes, it is possible, but it is easyer via FILTER BY FORM, CLEAR GRID, APPLY FILTER and REMOVE FILTER icons.
 

iainmid

Registered User.
Local time
Today, 07:25
Joined
Mar 1, 2007
Messages
35
How would i go about doing this using the search form i have setup.

I have been using an sql query with the fields on my search form as parameters but this only works if you enter data into all of the fields. i need to somehow say if one field is null don't use in the query
 

MStef

Registered User.
Local time
Today, 07:25
Joined
Oct 28, 2004
Messages
2,251
Look at attachment (word, zip).
 

Attachments

  • FilterForm.zip
    94.5 KB · Views: 108

Users who are viewing this thread

Top Bottom