Set Query Criteria thru Function

A

Abe Katz

Hi,
I'm setting a query criteria thru a function, i.e. V1="RED": SetCriteria(V1)
(setting global variable) and then I use in the Query Criteria another
function to get the global variable i.e. GetCriteria().
It works fine.
Now I want to set a criteria with multiple selections i.e.. V2="BLUE": V3=V1
& " or " & V2
and SetCriteria(V3) but it doesn't work.
I tried with adding (wrap around with) quotes to V1 and V2 but it doesn't
work.
I can make V3 looks like this ""RED" or "BLUE"". or "RED or BLUE"
Any suggestions?
Thanks
 
P

PieterLinden via AccessMonster.com

Abe said:
Hi,
I'm setting a query criteria thru a function, i.e. V1="RED": SetCriteria(V1)
(setting global variable) and then I use in the Query Criteria another
function to get the global variable i.e. GetCriteria().
It works fine.
Now I want to set a criteria with multiple selections i.e.. V2="BLUE": V3=V1
& " or " & V2
and SetCriteria(V3) but it doesn't work.
I tried with adding (wrap around with) quotes to V1 and V2 but it doesn't
work.
I can make V3 looks like this ""RED" or "BLUE"". or "RED or BLUE"
Any suggestions?
Thanks

global variables... <shudder>
You could do this with a form-level variable... Why not just save the core
structure of the SQL statement in a querydef and then append the WHERE and
ORDER BY clauses at runtime? Just save the original (unmodified) .SQL
property of the query into a string variable, modify the SQL property and run
the query, and then revert the SQL property back to the saved variable. You
can do all this through your form... should be simple...
 

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