Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2004
    Posts
    660

    Unanswered: log who modified the data

    We have access database, I would like to record all the data that is deleted or modified by somebody. Is it possible way to have a log file to record who delete and who modified the data? Thanks.

  2. #2
    Join Date
    Oct 2004
    Location
    Oxfordshire, UK
    Posts
    89
    Usually you'd create tables that would keep track of user edits and deletions. Examples of this can be found here: http://www.rogersaccesslibrary.com/TableOfContents3.asp (audittrail.mdb et al).

  3. #3
    Join Date
    Nov 2003
    Posts
    1,487
    Play with this Sample for a while (attached):

    .
    Attached Files Attached Files
    Environment:
    Self Taught In ALL Environments.....And It Shows!


  4. #4
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926

    Tracking

    The easiest way I did this was to:

    1. Create a DeleteLog Table (which has DateDeleted and DeletedBy fields)
    2. In the table I want to track the "Latest" modifications, add a DateModified and ModifiedBy field.
    3. Use the attached file and the "getuser" routine.
    4. On the interface form, when the "Delete" button is pushed, have a routine which writes to the DeleteLog table with the "getuser" routine and today's date (Note: if they are deleting via the table directly or via a query, you'll have to use another technique).
    5. On the form, using the OnChange event (or maybe it's the AfterUpdate event), have code which populates the DateModified with today's date and the ModifiedBy field with the "getuser" routine (attached). If your form is UNBOUND, then make an unbound checkbox which when data is changed (AfterUpdate event on each field you would want to track), this checkbox is marked as true and when the user closes the form, it checks to see if the checkbox is marked as true and writes in the DateModified and ModifiedBy fields before calling your "Save" record routine.

    Note: You can also use the "getuser" routine as a default for a field such as EnteredBy which you may want to have in your main table and on the form (and also a DateEntered field which defaults to today's date).

    Note: You could also add another table which logs which fields get changed and to what values they change to but this is a little more in-depth and requires programming events such as possibly on the AfterUpdate of each field.

    But using the "getuser" routine attached might be helpful in recording who entered/changed the data. I use this routine quite often setting default values such as on the EnteredBy field to =getuser(). It also works in an append/update query setting the Expression = getuser().
    Attached Files Attached Files
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  5. #5
    Join Date
    Mar 2004
    Posts
    660
    Thank you for all your help. I am going to try your sample.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •