Results 1 to 9 of 9
  1. #1
    KEVWB is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2011
    Posts
    11

    Save details of who modified a record

    Hi,



    I have a subform within a form and would like to record details of which user last modified the data, I am getting userID from pc login but have no idea how to proceed further, any help given would be much appreciated,

    Thanks in advance

  2. #2
    jgelpi16 is offline Expert
    Windows XP Access 2010 32bit
    Join Date
    Mar 2010
    Location
    Charlotte, NC
    Posts
    544
    Create a "LastUpdateUser" and "LastUpdateDateTime" field in your table. Then create a text box that is bound to each of those fields. Hide the text boxes and when a user makes a change you want to track have some VBA code set up to dump the UserID and Date into the necessary text boxes.

  3. #3
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    Kevin,

    I'm not sure if it would help, but I have a published article about audit trails here: http://www.databasedev.co.uk/audit_trail.html

    Maybe it can help give insight.

  4. #4
    KEVWB is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2011
    Posts
    11

    Thanks

    Many thanks for the info will try over weekend.

    Cheers

    Kev

  5. #5
    KEVWB is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2011
    Posts
    11
    Many thanks,

    Have tried it and it works, will also try to set up an audit trail as advised Adam

    Cheers

    Guyz

  6. #6
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    marked solved

  7. #7
    pkstormy's Avatar
    pkstormy is offline Access/SQL Server Expert
    Windows XP Access 2003
    Join Date
    Mar 2010
    Location
    Madison
    Posts
    682
    Here's a simple way to set up an auditing trail if you're interested.

    https://www.accessforums.net/code-re...rds-10212.html

    It doesn't have all the overhead coding I've seen with other methods.

  8. #8
    cnstarz is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    Oct 2010
    Posts
    31
    pkstormy, i downloaded your db, imported the modules and class modules, and i forget what else i did cuz my brain is tired right now (lol), but i'm getting the following error when i make an edit to a field on the form:

    "Compile error:

    User-defined type not defined"

    the following line is then highlighted yellow with an arrow pointing towards it in vb editor:

    Code:
    Function LogDataChange(IDValue As Variant, TblName As Variant, FldName As Variant, OldValue As Variant, NewValue As Variant)
    and "As ADODB.Recordset" is highlighted in this line:

    Code:
    Dim rs As ADODB.Recordset

    edit: fixed! in vbedit, i had to go to tools>references and check "Microsoft ActiveX Data Objects 2.1 Library". now it's working gloriously. thanks for example!

  9. #9
    pkstormy's Avatar
    pkstormy is offline Access/SQL Server Expert
    Windows XP Access 2003
    Join Date
    Mar 2010
    Location
    Madison
    Posts
    682
    I was just going to recommend going to the References when I read the last line in your post. Thanks for letting me know. I'm glad you got it working. I use this technique quite often for our medical data.

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

Similar Threads

  1. Replies: 3
    Last Post: 02-01-2011, 07:15 AM
  2. Duplicate Record Cannot Save
    By magicscreen in forum Programming
    Replies: 2
    Last Post: 09-15-2010, 08:15 AM
  3. save last record in table through a form
    By ajetrumpet in forum Forms
    Replies: 3
    Last Post: 09-09-2010, 08:53 AM
  4. Replies: 0
    Last Post: 10-16-2008, 02:39 PM
  5. Replies: 1
    Last Post: 09-20-2007, 02:56 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