I’ve designed a database consists of a main form and a sub form. I’ve also created an audit trial, to track down the user name who last modified the record. It works fine in record was modified in the main form but in the subform, it only works on one control. Following is the code I used:
-----********************----
Option Compare Database
Private Function ModifiedInfo()
On Error GoTo ERROR_HANDLER
[LastModifiedBy].Value = Forms![frmMain]!lblUser.Caption
[TimeModified].Value = TimeValue(Now())
[DateModified].Value = DateValue(Now())
Exit Function
ERROR_HANDLER:
MsgBox (Err.NUMBER & vbCrLf & Err.Description)
Resume Next
End Function
----*******************----
Thanks,
DD
-----********************----
Option Compare Database
Private Function ModifiedInfo()
On Error GoTo ERROR_HANDLER
[LastModifiedBy].Value = Forms![frmMain]!lblUser.Caption
[TimeModified].Value = TimeValue(Now())
[DateModified].Value = DateValue(Now())
Exit Function
ERROR_HANDLER:
MsgBox (Err.NUMBER & vbCrLf & Err.Description)
Resume Next
End Function
----*******************----
Thanks,
DD