SQL syntax for Filtering a report

  • Thread starter Thread starter Neil Crawford
  • Start date Start date
N

Neil Crawford

Dear all,

Can you advise me of the correct syntax I should be using
in my variable strSQL please.

I'm using Docmd.OpenReport "ReportName", acPreview,,strSQL
to open a report using the SQL statement strSQL.

So far I've written as follows;-

strSQl = "[Firstpartpostcode] = '" & "BH1" & "'"

This works but I can't add another value to the string
and get it to work i.e. Or BH2. I can't find any guidance
in my books - they all seem to stop at one value!

thanks,

neil
 
There are several methods:
strSQl = "[Firstpartpostcode] IN ('BH1',BH2')"
or
strSQl = "[Firstpartpostcode] = 'BH1' or [FirstPartPostCode] = 'BH2'"
 
So Neil, you are the spammer who is blocking people getting genuine answers
by posting endless, annoying, mindless, boilerplate responses so it looks as
if the person has an answer, when in fact they received nothing but an ad?
 
Back
Top