Hello,
I am trying to set up simple tracking of changes made to our database but am having trouble.
I found simple tracking instructions and did as it directed but then in errors out on the code.
I added the four fields to my table that underlines the form as instructed (see below).
CreateBy
CreateDate
ModBy
ModDate
Then I went into the form and did the next step which was to add code to the Current and BeforeUpdate events of the form...see below...
Option Compare Database
Option Explicit
Private Sub Form_BeforeUpdate(Cancel As Integer)
ModBy = Environ("username")
ModDate = Now()
End Sub
Private Sub Form_Current()
If Me.NewRecord Then
CreateBy = Environ("username")
End If
End Sub
When I saved it I got the below message...
Compile Error - Variable not defined on CreateBy = Environ("username")
I am trying this at home and not at work and I think it wants me to define username but not sure with what - we don't require a log-in to the database - would I need to do that - not really sure?
Thank you for any help.
Lisa
This database does not require the users to log in - the users can simply open it and use the forms.