Date Range using Between AND

P

pon

Iam creating a Parameter Query using BETWEEN [Begin_date] AND [End Date].
But the End Date is not inclusive in the query result.
What am I missing?
Please help.
Thank you
Pon
 
P

pon

I tried Between [Prior Year Begin Date MM/DD/YYYY] And DateAdd("d",1,[Prior
Year End Date MM/DD/YYYY]) and it worked.
Thank you
Pon
 
J

John Spencer

The problem is probably that your Date field contains a time component. If
none of your times are exactly midnight then you can use

Between [Begin_date] and DateAdd("d",1,[End_Date])

or use the following criteria which doesn't care if the date field ends at
midnight.
= [Begin_date] and < DateAdd("d",1,[End_Date])

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

pon said:
Iam creating a Parameter Query using BETWEEN [Begin_date] AND [End Date].
But the End Date is not inclusive in the query result.
What am I missing?
Please help.
Thank you
Pon
 
M

Michel Walsh

Your data probably has TIME in addition to DATE.


Where you say

myDateTime BETWEEN dateFrom AND dateTo


that implied dateTo is at 00:00:00. But be aware that " dateTo at
06:00:00 " is thus LATER, and OUTSIDE the BETWEEN range.



Use:


myDateTime >= dateFrom AND myDateTime < dateTo + 1




Hoping it may help,
Vanderghast, Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top