Results 1 to 3 of 3
  1. #1
    akika is offline Novice
    Windows 10 Access 2016
    Join Date
    Aug 2018
    Posts
    27

    access 16, add a field that will keep track on the number of changes done to a record

    Hii,




    How can keep track on the number of changes done to a record in field "change_no".

    Is it ok to used below code for audit... In the form & table i created fields modify_date, modify_by, create_by, create_date which are being populated.

    Private Sub Form_BeforeUpdate(Cancel As Integer)
    Me.modify_date = Now()
    Me.modify_by = Environ("USERNAME")


    End Sub


    Private Sub Form_Current()
    If Me.NewRecord Then
    Me.create_by = Environ("USERNAME")
    Me.create_date = Now()
    End If
    End Sub

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Seems your structure allows only one modification to a record and that might suit your situation. But if you want to allow many edits to record, unless you create a new record for each change, there is nothing on which to base an audit.

    Assuming you create a new record for each change, build a query that calculates a count of the change orders per project (or whatever your primary entity is).

    Review http://allenbrowne.com/AppAudit.html
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,114
    You could try to initialize the change_no=1 in the Current event then in the BeforeUpdate keep incrementing (Me.change_no=Me.change_no + 1).

    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

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

Similar Threads

  1. Track field changes in Access
    By adubberke in forum Access
    Replies: 2
    Last Post: 01-21-2016, 10:56 AM
  2. Replies: 5
    Last Post: 11-30-2014, 12:46 PM
  3. Replies: 4
    Last Post: 03-31-2014, 02:20 PM
  4. Replies: 3
    Last Post: 08-18-2013, 01:15 PM
  5. Replies: 8
    Last Post: 01-30-2013, 06:40 AM

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