A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

SQL syntax for Filtering a report



 
 
Thread Tools Display Modes
  #1  
Old May 18th, 2004, 09:26 PM
Neil Crawford
external usenet poster
 
Posts: n/a
Default 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  
Old May 18th, 2004, 10:39 PM
Duane Hookom
external usenet poster
 
Posts: n/a
Default 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  
Old May 19th, 2004, 07:39 AM
Allen Browne
external usenet poster
 
Posts: n/a
Default 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  
Old May 19th, 2004, 01:20 PM
Duane Hookom
external usenet poster
 
Posts: n/a
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:11 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.