Search records within date range

monks89

Registered User.
Local time
Today, 02:35
Joined
Mar 26, 2009
Messages
19
Online a found a sample code to search for records between 2 dates and I was wondering if you could tell me how to make it include the two dates and not just the one in between the entered dates.

The code is:
Between "#" & [Enter Start Date] & "#" And "#" & [Enter End Date] & "#"

Thanks

Also, how would the user format their start dates? Is it just mm/dd/yyyy?
 
You're talking about a parameter query and the string I use in all my queries is a little different, and it runs from the first typed date to the second, not excluding the first and last as you are concerned about:

Between [Type the start date] And [type the end date]

My date format is short system date (10/14/09), and the data entry is intuitive: as long as each parameter is within the current calendar year, I can type:

12 Oct
Oct 12

If it's outside the current year I type either the short system date or the full date (Oct 12 2008)
 
but doing

between startdate and enddate DOES include startdate and enddate

its effectively

itemdate >= startdate and iitemdate<= enddate

where it doesnt get everything is if your date includes a time as well - in which case if you have an end date of say

oct 21st 2009. then any item with that date AND a time (say oct 21st 9.40am) will NOT be selected as it is now AFTER the target date.
 

Users who are viewing this thread

Back
Top Bottom