How to use Form Filter in VB as an event.

H

himmelrich

Works correctly:
Forms![Master Search].Form.Filter = "[GTPO] = Forms![Master Search]!
Text63"
FilterOn = True

When I add the Or statement and use the 'Like' I get a syntax error.
Like this:
Forms![Master Search].Form.Filter = "[GTPO] = Forms![Master Search]!
Text63" Or "[Project Name] Like '*" & Forms![Master Search]!Text64 &
"*'"
FilterOn = True

what is wrong with statement above?
 
C

Carl Rapson

Works correctly:
Forms![Master Search].Form.Filter = "[GTPO] = Forms![Master Search]!
Text63"
FilterOn = True

When I add the Or statement and use the 'Like' I get a syntax error.
Like this:
Forms![Master Search].Form.Filter = "[GTPO] = Forms![Master Search]!
Text63" Or "[Project Name] Like '*" & Forms![Master Search]!Text64 &
"*'"
FilterOn = True

what is wrong with statement above?

The Or needs to be inside the quoted string:

Forms![Master Search].Form.Filter = "[GTPO] = Forms![Master Search]!
Text63 Or [Project Name] Like '*" & Forms![Master Search]!Text64 &
"*'"

Carl Rapson
 
Top