I have a form which is also build with a subform. In the form I add the date and time when a record is changed to a respective table in the database. So that, when the next administrator logs in he can see when the form was last updated. I used the following code:
Private Sub Form_BeforeUpdate(Cancel As Integer) On Error GoTo BeforeUpdate_Err
' Set bound controls to system date and time.
DateModified = Date
TimeModified = Time()
BeforeUpdate_End:
Exit Sub
BeforeUpdate_Err: MsgBox Err.Description, vbCritical & vbOKOnly, _ "Error Number " & Err.Number & " Occurred"
Resume BeforeUpdate_End
End Sub
This works successfully, and imports the date and time when a record has been last modified or added. The problem I am faced with is that, whenever I change the fields within the subform, the date and time is not updated to reflect to the change. How can I rectify this?
Thank you
Private Sub Form_BeforeUpdate(Cancel As Integer) On Error GoTo BeforeUpdate_Err
' Set bound controls to system date and time.
DateModified = Date
TimeModified = Time()
BeforeUpdate_End:
Exit Sub
BeforeUpdate_Err: MsgBox Err.Description, vbCritical & vbOKOnly, _ "Error Number " & Err.Number & " Occurred"
Resume BeforeUpdate_End
End Sub
This works successfully, and imports the date and time when a record has been last modified or added. The problem I am faced with is that, whenever I change the fields within the subform, the date and time is not updated to reflect to the change. How can I rectify this?
Thank you