Solved

Date Criteria in Access Query

Posted on 2011-03-24
3
523 Views
Last Modified: 2012-08-13
In our retail store, employees are limited to the number of purchases they can make during our business day, which is from 4:00am - 3:59am (e.g., 3/1/11 4:00am - 3/2/11 3:59am is the March 1st business day) I have an access database that simply keeps track of the number of purchases made. I can do this easily if I only needed to keep track of purchases during the current calendar date, but I can't figure out how to do it for the current business day.

I have a query with the follwing fields: employee ID, timestamp, TransactionCount. To pull transactions for the current calendar day, I just enter "Date()" in the criteria under the Timestamp field. What I need is to see all transactions between today's date @ 4am and tomorrow's date at 3:59am.

Any ideas would be appreciated!
0
Comment
Question by:IslandIT
3 Comments
 
LVL 119

Accepted Solution

by:
Rey Obrero earned 500 total points
ID: 35206963
try this criteria

Between Date() + timeserial(4,0,0) and Dateadd("d",1,Date()) + timeserial(3,59,0)
0
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 35206988
Probably not the most eleqant solution, but you coudl try:
WHERE [Timestamp] Between CDate(Date() & " 04:00") And CDate(Date()+1 & " 03:59")

Open in new window

0
 
LVL 33

Expert Comment

by:Mike Eghtebas
ID: 35207044
Where Format(PurchaseTime,"yyyy_mm_dd hh:nn")>=Format(Date(),"yyyy_mm_dd 04:00") AND Format(PurchaseTime,"yyyy_mm_dd hh:nn")<=Format(Date()+1,"yyyy_mm_dd 03:59")
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
ms sql stored procedure 22 77
Help with SQL Query 23 39
Access Date Query 28 29
How calculate median 5 38
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now