473,473 Members | 1,900 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to Where Clause with multiple criteria

I want to open a report using OpenReport and passing it a Where Clause
with multiple criteria.
I know the Where Clause below is way off but it conveys what I need.

Dates are of string type.

DoCmd.OpenReport "rpt_LOG", acViewPreview, , WHERE????

strDate1 = "Friday, July 20, 2007"
strDate2 = "Saturday, July 21, 2007"
strDate3 = "Sunday, July 22, 2007"

"[Weekend_Date] = """ & strDate1 & """ and """ & strDate2 & """ and
""" & strDate3 & """"

Confused
Rick

Jul 17 '07 #1
1 5647

"2D Rick" <rb*******@compuserve.comwrote in message
news:11**********************@i13g2000prf.googlegr oups.com...
I want to open a report using OpenReport and passing it a Where Clause
with multiple criteria.
I know the Where Clause below is way off but it conveys what I need.

Dates are of string type.

DoCmd.OpenReport "rpt_LOG", acViewPreview, , WHERE????

strDate1 = "Friday, July 20, 2007"
strDate2 = "Saturday, July 21, 2007"
strDate3 = "Sunday, July 22, 2007"

"[Weekend_Date] = """ & strDate1 & """ and """ & strDate2 & """ and
""" & strDate3 & """"

Confused
Rick
[Weekend_Date] can't be equal to all 3 dates at the same time, you may want
to use OR. Assuming [Weekend_Date] is a date type you need to use # around
the date and supply a date value.

"[Weekend_Date]=#" & datevalue(strDate1) & "# OR [WeekendDate]=#" &
datevalue(strDate2) & "# OR [WeekendDate]=#" & datevalue(strDate3) & "#"

or if your criteria is always Friday Saturday and Sunday

"[Weekend_Date] between #" & datevalue(strDate1) & "#" and "#" &
datevalue(strDate3) & "#"

If [Weekend_Date] stores date and time, add 1 date to last date

"[Weekend_Date] between #" & datevalue(strDate1) & "#" and "#" &
dateadd("d",1,datevalue(strDate3)) & "#"
Jul 17 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Chris Geihsler | last post by:
I have a set of udf's dealing that return a one column table of values parsed from a comma delimeted string. For example: CREATE FUNCTION . ( @patient_list varchar(2000) ) RETURNS...
3
by: A.V.C. | last post by:
Hello, I found members of this group very helpful for my last queries. Have one problem with CASE. I can use the column name alias in Order By Clause but unable to use it in WHERE CLAUSE. PLS...
2
by: Ellen Manning | last post by:
Using A2K. In my table I have the field "Grant" which can have a value or be null. I have a query that counts the number of records and has a Where clause on the Grant field. The query won't...
4
by: Barry Edmund Wright | last post by:
I would really appreciate your assistance. I am using Access 2000 to create a form that Lists Names and Addresses based on a number of selection criteria one of which is a combo box cboPCZip. All...
1
by: BerkshireGuy | last post by:
Hello everyone, I am reading a query's SQL string and adding criteria to that and then resaving it. I know, might not be the best method, but it seems to work and there are some pros to doing...
2
by: The Other Mike | last post by:
VS 2005 Is their a way to dynamically change the where clause in a datagridview or dataset? I have a search window where the user can enter a part number or description or customer etc... and...
2
by: Jim.Mueksch | last post by:
I am having a problem with using calculated values in a WHERE clause. My query is below. DB2 gives me this error message: Error: SQL0206N "APPRAISAL_LESS_PRICE" is not valid in the context where...
1
by: mtnbikur | last post by:
Lots of reading out there says you should only place “join criteria” in the join clause. That makes perfect sense. What about other search criteria? I’ve got other criteria, ie. cst_delete_flag =...
0
NeoPa
by: NeoPa | last post by:
Intention : To prepare a WHERE clause for multiple field selection, but to ignore any fields where the selection criteria are not set. ONLY WORKS WITH TEXT FIELD SELECTIONS. Scenario : You have...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.