Simple Date Query help

Flora2021

New Member
Joined
Apr 28, 2022
Messages
44
Office Version
  1. 365
Platform
  1. Windows
Hi, I am trying to run a query that will pull all records that match todays date or earlier. I have this working in the critera field <=Date() except it only shows records that match the dates prior to today, not also including todays date. Any suggestions? Thanks,
 

Attachments

  • Capture1.PNG
    Capture1.PNG
    2.2 KB · Views: 4

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
What is the data type of the "Issue Log" field?
Is it a Date/Time field that has a time component to it?

If so, the issue is that "Date()" returns midnight of the current date (time would be 12:00 AM or 0:00 in military time).
So any date of today that has ANY time component will come AFTER DATE().

One way to address this is to change the criteria to something like this:
Rich (BB code):
< (Date()+1)
which basically says less than midnight of tomorrow, so all dates/times of today will be included, and all date/times of tomorrow will not.
 
Upvote 0
of the "Issue Log" field?
Is it a Date/Time field that has a time component to it?
What is the data type of the "Issue Log" field?
Is it a Date/Time field that has a time component to it?

If so, the issue is that "Date()" returns midnight of the current date (time would be 12:00 AM or 0:00 in military time).
So any date of today that has ANY time component will come AFTER DATE().

One way to address this is to change the criteria to something like this:
Rich (BB code):
< (Date()+1)
which basically says less than midnight of tomorrow, so all dates/times of today will be included, and all date/times of tomorrow wi
Hi, I was using the date format. Your suggestion worked perfect. Thank you:) Could you help with this other issue too? On a separate query i am trying to pull records that are 14 days old including today past the date entered. I was using <Date()-14 but its pulling a single record from 5/10/22 but not records from 4/10/22 , 6/1/22, or 6/4/22. Any ideas why this one wont work? Thanks
 
Upvote 0
I was using <Date()-14 but its pulling a single record from 5/10/22 but not records from 4/10/22 , 6/1/22, or 6/4/22. Any ideas why this one wont work?
I wouldn't expect it to pull dates 6/1/22 or 6/4/22 (as those are not less than 6/1/22), but it should return date 4/10/22.
Please post a sample of your data, and the SQL code from your query (change to SQL View and copy and paste code here).
 
Upvote 0

Forum statistics

Threads
1,214,646
Messages
6,120,715
Members
448,985
Latest member
chocbudda

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