Results 1 to 5 of 5
  1. #1
    FormerJarHead is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Posts
    52

    Track employee who made changes to record.

    Hi all,

    Is there a way to track the changes made to a record? I have added a timestamp field to my form that indicates when the record was changed but I would also like to know which of my staff has made the change. Is this possible and if so can you help with any code that I may need to use. I found this on line but I'm having no luck with it working:
    CODE:
    Private Sub Form_BeforeUpdate(Cancel As Integer)
    ' Log the user details to the table
    Me!UpdatedBy = CurrentUser()
    Me!TimeStamp = Now()

    End Sub




    What this gives me in the Updated By control is "Admin" instead of the users name.

    What do I need to do to fix this?

    Thank you

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    CurrentUser() only works with Access Security. You can use this:

    http://access.mvps.org/access/api/api0008.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    FormerJarHead is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Posts
    52
    Quote Originally Posted by pbaldy View Post
    CurrentUser() only works with Access Security. You can use this:

    http://access.mvps.org/access/api/api0008.htm
    Should I put this in the Before Update =[fOSUserName]

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Following your earlier code:

    Me!UpdatedBy = fOSUserName()

    I typically grab it when the program starts and hold it somewhere (variable or form control) for later use, so I don't have to keep calling the function. Minor thing though.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    FormerJarHead is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Posts
    52
    Perfect!!!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 09-16-2012, 12:34 AM
  2. Replies: 1
    Last Post: 08-06-2012, 08:47 AM
  3. Replies: 8
    Last Post: 06-06-2012, 12:28 PM
  4. Replies: 1
    Last Post: 03-28-2012, 03:27 PM
  5. Creating a Database to track Employee Training
    By osolaru in forum Database Design
    Replies: 9
    Last Post: 08-25-2011, 01:29 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums