Query Criteria help

hmongie

New Member
Joined
Mar 26, 2003
Messages
16
I need help creating a time criteria for a query. What I would like to do is create a time criteria where the query will retrieve data from a table from the previous date and the current date within a particular time frame.

what I have now (which doesn't work)...

Between <previous date> #11:00:00 PM# And Date()#7:00:00 AM#

Any help would be appreciated!!! Thanx!
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Hiya

You'll have to put in the full date, if you want records from the previous and current dates.

HTH

coyotem78
 
Upvote 0
Using u'r example and today's date

Between #11:00:00 PM# And Date()#7:00:00 AM#

would become

Between #5/22/2003 11:00:00 PM# And #5/23/2003 7:00:00 AM#
 
Upvote 0
Will the date always be current?
What I had in mind was to be able to print out a report that have records form the day before to the current day. This should change as the day changes. If I was to place a full date in such as 5/22/2003 then the next day, I would not be able to print the current report as I need to.

If you can help me let me know?
 
Upvote 0
This should work on any date you run it:

Between Date()-1+TimeSerial(23,0,0) And Date()+TimeSerial(7,0,0)

The 23 in TimeSerial represents 11 PM.

HTH,

Russell
 
Upvote 0
Hey there Russell,

It works on the Date Criteria but the time from the following day does not come up... What should I put in the time criteria? Thanks for helping out on this issue....
 
Upvote 0

Forum statistics

Threads
1,221,531
Messages
6,160,359
Members
451,642
Latest member
mirofa

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top