If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
SQL syntax for Filtering a report
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 |
#2
|
|||
|
|||
SQL syntax for Filtering a report
There are several methods:
strSQl = "[Firstpartpostcode] IN ('BH1',BH2')" or strSQl = "[Firstpartpostcode] = 'BH1' or [FirstPartPostCode] = 'BH2'" -- Duane Hookom MS Access MVP -- "Neil Crawford" wrote in message ... 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 |
#3
|
|||
|
|||
SQL syntax for Filtering a report
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? wrote in message ... Thanks, that worked, Neil |
#4
|
|||
|
|||
SQL syntax for Filtering a report
I assume Neil just replied to the wrong message. I hope the free advice
helped. -- Duane Hookom MS Access MVP "Allen Browne" wrote in message . au... 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? wrote in message ... Thanks, that worked, Neil |
Thread Tools | |
Display Modes | |
|
|