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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top