Query TODAY & Time value

swaink

Active Member
Joined
Feb 15, 2002
Messages
432
Hi All

May I seek advice please

I am trying to use a query to feed a Pivot table but I want to make it dynamic so that the user does not need to change anything.

The only point I am struggling is with locking it down to look at TODAY & NOW

I need to set the query to count occurences of an event where the date is TODAY, I also need to tie this down to a fixed time "06:00:00" for the start of the range but a dynamic time for the end range.

This is to ensure I have a running count for each of the events I am tracking

I have tried Between TODAY & '06:00:00' AND TODAY & NOW without success
for example this would have looked like between '2011-09-23 06:00:00' AND '2011-09-23 08:00:00

Any advice will be appreciated

Thank you

Kevin
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
This is an SQL query not an Excel query right?

Not all data sources would recognise a date as for example '2011-09-23 08:00:00' which appears to be SQL Server style

if its Ms Access you may need #23/09/2011 06:00# so you need to understand your datasource
 
Upvote 0

Forum statistics

Threads
1,224,613
Messages
6,179,904
Members
452,948
Latest member
Dupuhini

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