View Full Version : Search on form using mulitple fields


iainmid
10-28-2008, 12:55 PM
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
10-29-2008, 01:44 AM
Yes, it is possible, but it is easyer via FILTER BY FORM, CLEAR GRID, APPLY FILTER and REMOVE FILTER icons.

iainmid
10-29-2008, 02:33 AM
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
10-29-2008, 03:09 AM
Look at attachment (word, zip).