Subject: multiple stLinkCriteria?
Posted By: universal Post Date: 1/31/2004 3:42:27 AM
Hello all,

Iam a complete beginner, so please be gentle.  Im trying to (if possible) create a form to be used as a "search" facility of another form.

All users list their favourite foods:
dave    eggs    chocolate
steve   cheese  chocolate
tony    beef    chocolate

And so in my search I have a combobox of eggs, chocolate, cheese, and beef.
Should eggs be selected I would like only dave to be shown on the next form.  Though if chocolate is selected, then all three need o be shown.

So far I've got:
stLinkCriteria = "[food1]=" & "'" & Me![chooser] & "'" And "[food2]=" & "'" & Me![chooser] & "'"
but this doesnt work, and is probably not the most elegant way of doing this.

Any ideas?

Many thanks
Ed



Reply By: sal Reply Date: 1/31/2004 1:15:24 PM
use an IN() operator in your sql statement whenever you have a list of possible values to use:

IN('eggs','cheese','beef')

IN('eggs')

or for numeric values

In(1,2,3,4,5,6)

The sintax may differ as far as whether to use single quotes or double quotes depending on your back end: Access, Sql server, Oracle, DB2, Etc. I get confused...

Are you familiar with VBA or ADO?



Sal

Go to topic 9208

Return to index page 958
Return to index page 957
Return to index page 956
Return to index page 955
Return to index page 954
Return to index page 953
Return to index page 952
Return to index page 951
Return to index page 950
Return to index page 949