Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Microsoft: Access Other topics FAQ


Date stamp records and capture User name when data is added or changed by elizabeth
Posted: 12 Jun 00

You can capture and track the name of the user and the current Date & Time every time a record is added or changed in a table. Here's how:

1. Go into design view of the table.
2. Create 4 new fields: CreatedDate, CreatedByUser, ChangedDate, ChangedByUser.
2. Set the 2 User fields to data type Text,  with a field size the length of a login ID.
3. Set the 2 Date/Time fields to data type Date/Time.
4. For date only, set format to Short Date. For Date & Time set format to General.
5. Set the default value of CreatedDate to Date() for date only; Now() for date & time.
6. Go into design view of your data entry form.
7. Capture the Access loginID with CurrentUser() or NT's login with Environ("username").
8. Use the Before Insert event to load the user logidID when adding a new record.
9. Use the Before Update event to load the user & datestamp when updating a record.

Here's an example of how to load a value:

Private Sub Form_BeforeInsert(Cancel As Integer)
    Me!UpdatedByUser = Environ("username") ' this is the NT loginID
    Me!UpdatedByUser = CurrentUser()           ' use this line if you want the Access loginID
    Me!UpdatedDate = Date()
End Sub

Back to Microsoft: Access Other topics FAQ Index
Back to Microsoft: Access Other topics Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close