Using a control button on a form(Switchboard) to insert the current date in a table
Our current Switchboard displays a msgbox with the date and time of the most recent records update. This is a discretionary call, and not all changes in records result in changing this value. The Switchboard On Load form event contains the msgbox code. I want to eliminate the msgbox edits and replace the msgbox with a subform on the Switchboard that displays the most recent value of a field in table subUPDT.
Table subUPDT contains two fields, UPDTID (autonumber) and UPDT (date & time). How do I program the command button (btnUPDT) on the Switchboard so that it inserts the current timestamp into subUPDT.UPDT and then refreshes the Switchboard to display the most recent value?
As you have likely deduced, I am not a professional programmer. I do realize this may not be the most refined approach and am open to suggestions. Thank you for any assistance.
Solution 1:
So I looked at the INSERT function as suggested (Thanks, HansUp!), but then decided that I preferred to update the existing date entry instead of creating a growing table with subsequent entries after each update. I chose the DoCmd.OpenQuery function to run a SQL update query when I click my Update Button.
The SQL query basically says:
UPDATE *SubTable A* SET *Last Update Field* = Now();
When I click the update button on my admin interface (form), it updates the Last Updated field in SubTable A with the current date and time. SubTable A contains a single entry for the most recent update timestamp. I then use that field in a number of forms to inform users, and myself, of the most recent, significant change to the table. Not an elegant solution, but one that works.