I'm new to programming, but I am currently developing a new client database for the company I work for using VBA for Microsoft Access 2016, and macros.
Within this system, there are a set of forms which act as our individual note-taking/to-do lists and sometimes we duplicate a record to save manually inputting the same data many times over. On each form there are two Date/Time fields which auto input the current date and time, one displays date only and the other is time only.
At the moment, to duplicate a record I'm using the pre-programmed macro 'duplicate record' function in the command button wizard. This creates a carbon copy of the record, including the date and time. What I'd like to do is be able to click that button, and have it copy the record whilst auto-updating the date and time fields to the current system time.
The pre-programmed macro is as follows in the On Click event:
OnError
Go to Next
Macro Name
RunMenuCommand
Command SelectRecord
If [MacroError]=0 Then
RunMenuCommand
Command Copy
End If
If [MacroError]=0 Then
RunMenuCommand
Command RecordsGoToNew
End If
If [MacroError]=0 Then
RunMenuCommand
Command SelectRecord
End If
If [MacroError]=0 Then
RunMenuCommand
Command Paste
End If
If [MacroError]<>0 Then
MessageBox
Message =[MacroError].[Description]
Beep Yes
Type None
Title
End If
Is there something I can add to this macro to make the date and time fields auto update on duplicating a record, or should I use VBA for this procedure?
If you need any more information, just ask.