r.harrison
It'll be fine (I think!)
- Local time
- Today, 22:47
- Joined
- Oct 4, 2011
- Messages
- 134
Hi All,
Normally I would do this in VBA, but I'm intrigued as to whether I can do it in a query.
I'm building an advanced search for my DB and the user can select many option:
1) What field to search in
2) Whether to search the entire field, or Any part of the field
3) Whether to search all records, or just 'Live' Records.
To do this I'm trying to use the iif statement. But can't get the LIKE operator to work inside the iif.
eg:
IIf([srchCriteria1]=1,Like '*' & [name] & '*',[name])
This works fine if srchCriteria1 isn't '1' and the full name is found. But can't get it to search any part of field.
Any help greatly appreciated.
Normally I would do this in VBA, but I'm intrigued as to whether I can do it in a query.
I'm building an advanced search for my DB and the user can select many option:
1) What field to search in
2) Whether to search the entire field, or Any part of the field
3) Whether to search all records, or just 'Live' Records.
To do this I'm trying to use the iif statement. But can't get the LIKE operator to work inside the iif.
eg:
IIf([srchCriteria1]=1,Like '*' & [name] & '*',[name])
This works fine if srchCriteria1 isn't '1' and the full name is found. But can't get it to search any part of field.

Any help greatly appreciated.