Results 1 to 5 of 5
  1. #1
    2 Star Lounger
    Join Date
    Mar 2001
    Posts
    165
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Last updated field (2002 SP-3)

    Is there a way to create a field that would show the date on which individual records in a database were updated?
    Clark

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Last updated field (2002 SP-3)

    You can add a date/time field DateLastModified to each table where you need it.
    In each form based on such a table, create a Before Update event procedure for the form:

    Private Sub Form_BeforeUpdate(Cancel As Integer)
    Me.DateLastModified = Date
    End Sub

    If you already had a Before Update event procedure, you can simply add the line

    Me.DateLastModified = Date

    to the existing code.

    Notes:
    1) If you would like to know the date and time of last modification, use ... = Now instead of ... = Date.
    2) Access doesn't have triggers at the table level, so the DateLastModified field will only be updated when a record is edited via a form.

  3. #3
    5 Star Lounger
    Join Date
    Nov 2001
    Location
    Toronto Canada
    Posts
    920
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Last updated field (2002 SP-3)

    Hi Hans,

    Quick question while on the subject of identifying modification dates & times. I don't suppose that there is an easy way of identifying which field was modified and if possible the before and after status? I suspect that it would be a whole audit system routine, which I realize has been alluded to in other parts of the Forum, to do this, but I thought you might know of an easier way of accomplishing the same,

    Cheers
    Cheers,
    Andy

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Last updated field (2002 SP-3)

    As you hint yourself, that would amount to creating an audit trail. There is no easy shortcut for that.
    See Allen Browne - Creating an Audit Log.

  5. #5
    5 Star Lounger
    Join Date
    Nov 2001
    Location
    Toronto Canada
    Posts
    920
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Last updated field (2002 SP-3)

    Thanks Hans,

    I unfortunately thought as much. I've checked and printed out Allen's article which looks excellent.

    Cheers,
    Cheers,
    Andy

Posting Permissions

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