Apply Filter in two fields

vorn666

Registered User.
Local time
Today, 23:59
Joined
Mar 5, 2007
Messages
10
Hi all,

I have the following working line of code (Running once a button is pressed in a form)

DoCmd.ApplyFilter , "[Site Location] = 'Site A'"

However I now need to modify this to search for the text in two fields, both Site Location and Site Location2, to return results if it is found in either field.

Any help greatly appreciated, as I have tried various ideas and it either returns all records or no records.

Cheers,
 
DoCmd.ApplyFilter , "[Site Location] = 'Site A' OR [Site Location2] = 'Site A'"
 
Something like this?

PHP:
varLocation = "Site A"
Me.filter = "([Site Location] Like " & varLocation & ")" & Or & "([Site Location] Like " & varLocation & ")"
[PHP]
 
Many thanks Peter - works perfectly!

John, will look into yours too when I have finished this update, as it looks like i will learn a few things going through that one.
 

Users who are viewing this thread

Back
Top Bottom