MS query returning wrong dates

stevecox

New Member
Joined
Jul 17, 2014
Messages
2
Hi, I am trying to return records from an SQL database using MS query in Excel. I only want records after my chosen dates but keep getting records from before as well.

I have used the greater than or equal to comparison in my query for the date criteria but it still returns dates previous to this in my table. My date format is DD/MM/YYYY and is in text format in the SQL database

I used: >=[startdate]

Any clues as what i can do? :(

Thanks

Steve
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Could this have something to do with the way Excel stores dates internally?
Maybe you need to convert the SQL date to a "readable format" before the comparison?
 
Upvote 0
Thanks for the reply; i believe the comparison happens in MS Query before it is loaded into the table in Excel, so I think it is trying to compare dates as text; i.e how they are stored in the SQL database. I cannot change this as other users are using it for other reports.

I may need to convert the txt date to a number date in an expression in y query but dont know how? Yet
 
Upvote 0

Forum statistics

Threads
1,223,636
Messages
6,173,483
Members
452,516
Latest member
archcalx

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