Results 1 to 6 of 6
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    austin, Texas, USA
    Posts
    1,029
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I noticed there's events attached to onChange and onDirty and i was wondering if it's possible to scan a table to detect all rows where one or more fields have either changed or become marked as Dirty? i am trying to come up with a batch operation that kicks in when the user is done making edits, and i thought, if it's possible to detect a field changes status that would be a good way to find all edits.

    Hope that makes sense...

    TIA!

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    On Change and On Dirty are events of several controls such as the text box. They are not properties of a record.

    If you want to keep track of records being changed, you can add a date/time field LastModified to the table, and set its value in the Before Update event of the form(s) used to enter/edit data in the table:

    Code:
    Private Sub Form_BeforeUpdate(Cancel As Integer)
      Me.LastModified = Now
    End Sub
    Access does not have triggers at the table level. SQL Server does, though, but you have to set them in SQL Server - Access can't get at them.

  3. #3
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    austin, Texas, USA
    Posts
    1,029
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks - I'll think about doing the time stamp column. what i want is a quick way to automatically flag all rows where some changes was made.

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

  5. #5
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    austin, Texas, USA
    Posts
    1,029
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by HansV View Post
    interesting article on audit logging. not sure if i'll use it but nice to know about the option.

  6. #6
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,624
    Thanks
    3
    Thanked 60 Times in 60 Posts
    As Allen Browne notes, there are a number of limitations to the approach he has suggested, and he also notes that Access 2010 will have macros that operate at the record level in tables. But that requires that you use ACCDB format databases. And frankly SQL Server triggers are much more powerful in my opinion, even if they are a pain to design and debug. We do archiving on selected tables in some of our applications, and it seems to work quite well. The advantage is that it works even if the user gets to the table to make changes or deletions.
    Wendell

Posting Permissions

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