I've tried sysdate in an sql statement, ie "select a,b,c from d where submitted_date > sysdate - 30;" and get an error - unknown function. I have googled for the answer and not found a reference to this. Does anyone know the answer? Thanks.
Very true. Running a SELECT query in VBA doesn't really accomplish anything.
Typically, you would either run an Action Query in SQL, or perhaps build some SELECT query SQL code so you can assign it to an existing query (that may be used by Reports/Forms, etc).
Thanks for the correction I have used hashes in the past... and I agree when running SQL from vba it can be tricky.....
I remember debugging code a few years ago where I had put an * in the VBA SQL string.... It wouldn't take it seeing as % is necessary when using VBA. I was on the verge of going bonkers.
Just because it worked does't mean it's the correct way to do things.
@xenou
Seems like we always get aboard these Access Date Threads
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.