What is the sysdate equivalent in Access docmd.runsql?

01-7700

Board Regular
Joined
Nov 7, 2011
Messages
62
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. :p
 
Another minor detail DoCmd.RunSQL would require an action statement (Insert/Update/Delete) and I'm not sure it will do anything withSelect.
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).
 
Upvote 0

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
xenou & Joe4,

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

ahhahahhah
 
Upvote 0

Forum statistics

Threads
1,221,816
Messages
6,162,148
Members
451,746
Latest member
samwalrus

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