Hi all,
I have a VBA search string, called searchstr, which looks through all records for a key word. It works fine.
The string uses all 'Or ' as in:
Searchstr = "[LatinName] Like "*plant*" or [CommonName] Like "*plant*" or [Plantedin] Like "*plant*" or [PlantDesc] Like "*plant*" or [HardyRef] Like "*plant*" or [PlantType] Like "*plant*" or [Colour] Like "*plant*" or [Light] Like "*plant*" or [Cultivation] Like "*plant*" or [Propagation] Like "*plant*" or [Pruning] Like "*plant*" or [Pests] Like "*plant*" or [Diseases] Like "*plant*" or [Comments] Like "*plant*"
Now, I want to include an 'And' to provide an option to include archived records or not, as in:
[HardyRef] Like "*plant*" or [PlantType] Like "*plant*" or [Colour] Like "*plant*" or [Light] Like "*plant*" or [Cultivation] Like "*plant*" or [Propagation] Like "*plant*" or [Pruning] Like "*plant*" or [Pests] Like "*plant*" or [Diseases] Like "*plant*" or [Comments] Like "*plant*" And [Archived] = False
But it appears to ignore the Archive condition.
All of the fields are in the one table.
Any ideas as to why that might be? Is it not possible to use Or and And in the same string search? Or is my syntax incorrect?
Thanks
Dave E
I have a VBA search string, called searchstr, which looks through all records for a key word. It works fine.
The string uses all 'Or ' as in:
Searchstr = "[LatinName] Like "*plant*" or [CommonName] Like "*plant*" or [Plantedin] Like "*plant*" or [PlantDesc] Like "*plant*" or [HardyRef] Like "*plant*" or [PlantType] Like "*plant*" or [Colour] Like "*plant*" or [Light] Like "*plant*" or [Cultivation] Like "*plant*" or [Propagation] Like "*plant*" or [Pruning] Like "*plant*" or [Pests] Like "*plant*" or [Diseases] Like "*plant*" or [Comments] Like "*plant*"
Now, I want to include an 'And' to provide an option to include archived records or not, as in:
[HardyRef] Like "*plant*" or [PlantType] Like "*plant*" or [Colour] Like "*plant*" or [Light] Like "*plant*" or [Cultivation] Like "*plant*" or [Propagation] Like "*plant*" or [Pruning] Like "*plant*" or [Pests] Like "*plant*" or [Diseases] Like "*plant*" or [Comments] Like "*plant*" And [Archived] = False
But it appears to ignore the Archive condition.
All of the fields are in the one table.
Any ideas as to why that might be? Is it not possible to use Or and And in the same string search? Or is my syntax incorrect?
Thanks
Dave E