View Full Version : OpenReport and valid SQL WHERE clause


Randix
07-02-2001, 12:38 PM
I want to use the OpenReport command in conjunction with a wherecondition that contains multiple variables. I realize you don't use the word "WHERE", but I can't come up with the right expression. For example, if i want to include records where x=12 and x=35, how would i include it?

svar2 = ????????????
DoCmd.OpenReport svar1, acViewPreview, , svar2

if i'm not clear, i want it to run a report that includes 2 records--one where x=12 and one where x=35

[This message has been edited by Randix (edited 07-02-2001).]

Pat Hartman
07-03-2001, 12:50 PM
svar2 = "SomeField = 12 or SomeField = 35"

or

svar2 = "SomeField In(12,35)" which is a little better when you have several values to check because it is more concise.

If you want to use variables -
svar2 = "SomeField = " & FstVariable & " or SomeField = " & SndVariable