Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Date Criteria in Access Query

Posted on 2011-03-24
3
Medium Priority
?
548 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 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 2000 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 34

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Explore the ways to Unlock VBA Project Password Excel 2010 & 2013 documents. Go through the article and perform the steps carefully to remove VBA Excel .xls file.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

971 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