Hello everyone, I would like to compare dates using an Excel file as the Data Base :
Here is the format of my file : (01/29/2023 00:00:00) My excel column is in date format
This is my sql query :
"Select * From [Export$] where [Code] =‘22’ AND [Product Code] NOT IN (‘101748’) AND [MRP] NOT IN (‘091’) AND [Planned Delivery Date] >= "+DateOfTheDay
DateOfTheDay format : 02/03/2023
If I put my date in the same format, I get this error:
How can I compare these dates without changing the format of my Excel file?
The format of both dates should be the same. As I can see ‘DateOfTheDay’ format is dd/MM/yyyy and
The ‘Planned Delivery Date’ format is dd/MM/yyyy hh:mm:ss.
Please try modifying the format of ‘Planned Delivery Date’ to dd/MM/yyyy before passing it into the query.
I’m no expert on SQL queries but try the below code and let me know if this works for you,
Select * From [Export$] where [Code] =‘22’ AND [Product Code] NOT IN (‘101748’) AND [MRP] NOT IN (‘091’) AND CAST(Planned Delivery Date AS DATE) >= '+DateOfTheDay'
I succeeded! For those who want the solution here : I put the dates between # #build
“Select * From [Export$] where [Code] ='”+Code+“’ AND [Product Code] NOT IN ('”+Product+“‘) AND [MRP] NOT IN (’”+MRP+“') AND [Planned Delivery Date] <= #”+DateOfTheDay+“#”