Access Query Events

CaliKidd

Board Regular
Joined
Feb 16, 2011
Messages
173
Hi,

I have a select query that I export to an Excel spreadsheet on a regular basis. Is it possible to capture the Date the query is run and update it in a field in a table?

Thanks in advance for your help and expertise.
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Why not add a calculated field that uses the Date function to the query?
 
Upvote 0
I presume by table you mean a table in Access, thus I think the suggestion won't do what you want since Select queries don't update. I say that because get the drift that your select query is for exporting to Excel, but you want the date it was run to be stored in Access.

You have not provided any clue about this process or details about where you want this date to go. You should be able to either call an update an append query, or run a sql statement in code. Which query you need depends on your target table. If there is no applicable record, there is nothing to update, thus the Append query is what you'd need. If there is, is it the only record? If not, you need a WHERE clause to tell Access which record to update. The value you'd update or append to the table would be Date() if you want only the date, or Now() if you want the time as well. The sql statement for a single record date table might look something like
UPDATE tblExportDate SET tblExportDate.DateRan = Date

You will have to provide more info on the process and table(s) if I'm on the right track and you need more help.
Note: in case you are not aware, Date is a reserved word and should never be used for a field, table or object name.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,221,805
Messages
6,162,074
Members
451,738
Latest member
gaseremad

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