Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dates Criteria Query

Status
Not open for further replies.

markys98

Technical User
Sep 20, 2007
2
GB
Hello
I am trying to run a query showing transactions for a period 01/08/2007 to and including 24/08/2007. I have tried using the between function but this always leaves out the last date. Is there another function I should be using to show the transactions for 01/08/2007 to and including the transactions for 24/08/2007?

I would like to do the query so I don't have to put in the date after (ie 25/08/2007) to include the transactions for 24/08/2007.

Thanks

 
have you tried:
Code:
WHERE SomeDate Between #01/08/2007 12:00 am# AND #24/08/2007 11:59 pm#

Leslie

In an open world there's no need for windows and gates
 




FYI,

Date/Time values are NUMBERS, like right now in North Texas the Date/Time value is 39380.47262, which can be formatted to DISPLAY 10/25/2007 11:20.

So of my Between END Date is 10/25/2007, I miss, 10/25/2007 11:20, because 39380.47262 is greater than 39380, although it's the same day.

So what can you do?

1. code the end data as the Next day, like #24/08/2007#+1
2. code the end day as the day PLUS the latest time as Lesie suggested.
3. truncate the value in the date FIELD to only days like
Code:
WHERE CLng(SomeDate) Between #01/08/2007# AND #24/08/2007#



Skip,

[glasses] When a diminutive clarvoyant had disappeared from detention, headlines read...
Small Medium at Large[tongue]
 
Also, queries expect US formatted dates. 01/08/2007 is January 8th, 2007.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Use non ambiguous values:
Code:
WHERE SomeDate Between #2007-08-01 00:00# And #2007-08-24 23:59#

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top