time stamp in a new record.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to automatically added the database user's name to the record he or
she adds to the database. I also want to add the user's name who updates the
record. I see that I can time and date stamp a record that is updated, but
that's not enough to satisfy the overall use of my database.
I want to know the user who adds a new record
I want to know the user who updates a pre-recorded record, whether it be the
user who first added the record or a different user.
 
To add a timestamp to store who created a record, add a field for
"RecordAdded" and make the default of the record something like...

=CurentUser() & " " & Format(Date(),"short date") & " " & Time()

I would make this field locked so the user could not change it. I might
even make it hidden.

Rick B
 
You need to add four fields to the table:
LastUpdateDt
LastUpdateBy
CreateDt
CreateBy
You can set the default for the CreateDt field in the database design view to
Now()
The others will need to be populated in the update form's BeforeUpdate
event. If you are using Access security, you can use the CurrentUser()
function to provide the value for the name fields. If not, you'll need to
use the user's networkID.

Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.NewRecord Then
Me.CreateBy = CurrentUser()
Else
Me.UpdateBy = CurrentUser()
Me.UpdateDt = Now()
End If
End Sub

It is never a good idea to mush multiple attributes into a single column as
another poster suggested. That just makes using the data later more
difficult.
 
Back
Top