Search Query Criteria

epicmove

Ben
Local time
Today, 09:52
Joined
Apr 21, 2006
Messages
59
Hi guys,

Cant seem to work this one out. I have quite a complex search form. The underlying query displays the results in a list box on the same form.

So far I have used the following expression for all the fields on my form (whether text or integer values):
Code:
Like "*" & [Forms]![Frm_FrmSearch]![AssetName] & "*"

This appeared to work correctly. However, now my Asset Management System is storing a number of Equipment Type's. As one of the query criteria is Equipment Type ID it means that selecting PC (1) also displays the details for Printer (11), Scanner (12) etc......

I know why it does this (because these numbers start with a 1 and I am using a like expression). However I cannot seem to get it working.

The equipment type value is present in every record so I dont think I can use =FormValue or FormValue Is Null. I did try:
Code:
=[Forms]![Frm_FrmSearch]![EquipmentType] Or
Like "*" & [Forms]![Frm_FrmSearch]![EquipmentType] & "*"

but it seemed to skip the first parameter and still displayed printers etc. as before.

Any ideas?
 
but it seemed to skip the first parameter and still displayed printers etc. as before

It doesn't.
Your first condition is also met within your second condition.
If you want to search on a specific Equipment Type, you do need to do an exact search using your first condition.

If you would like to be able to search on Equipment Type using wildcards, you could put a check box on your form so you user can determine whether or not to search using wildcards.
You then could build up your query using VBA basing on the value of the check box.

Rv
 

Users who are viewing this thread

Back
Top Bottom