MS Query show records that are not updated for 15 days or greater

v8chevy68

New Member
Joined
Jan 10, 2017
Messages
12
Hi All

I have an ODBC datasource which I need to use with MS Query

There is a field called 'modified date' which contains 1000's of records.

I need to make the query return only records that are 15 days or greater since last modified

The 'modified date' field cannot be changed as it is on an external system.
The field also includes a time-stamp

example: 2018-02-27 14:15:53.000

Please can anybody advise me how i can accomplish this?
Many thanks
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
can you post your actual query here (without user or password identified)
 
Upvote 0
Hi There
i cant post the query,
i have tried the following syntax but it fails

=> today()-15
Thanks again for any suggestions
 
Upvote 0
Record a macro of you doing the MS Query, including the Filter Data step where you choose 'modified date' less than or equal to an arbitary date. The generated code will show you the correct syntax for the WHERE part, which you can edit and change to use the Format and Date functions, something like this:

Code:
"WHERE (`Sheet1$`.`modified date`<={ts '" & Format(Date - 15, "YYYY-MM-DD") & " 00:00:00'})"
 
Upvote 0

Forum statistics

Threads
1,223,910
Messages
6,175,318
Members
452,634
Latest member
cpostell

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