Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8824607
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T06:40:35+00:00 2026-06-14T06:40:35+00:00

I have a need for a track-changes capability in Access 2010. I ran across

  • 0

I have a need for a “track-changes” capability in Access 2010. I ran across this script which should do the trick with a little work.

It’s clear and understandable but it doesn’t quite yet handle all of the cases I need for textboxes. (I’ll implement other controls later.) This is the pertinent structure as written. It’s called as an event procedure for the Before Update event on a form:

Const cDQ As String = """"

Sub AuditTrail(frm As Form, recordid As Control)

    'Track changes to data.
    'recordid identifies the pk field's corresponding
    'control in frm, in order to id record.

    Dim ctl As Control
    Dim varBefore As Variant
    Dim varAfter As Variant
    Dim strControlName As String
    Dim strSQL As String

    On Error GoTo ErrHandler

    'Get changed values.

    For Each ctl In frm.Controls    
        With ctl
            'Avoid labels and other controls with Value property.
            If .ControlType = acTextBox Then
                If .Value <> .OldValue Then
                    'Add record of change to logging table   
                End If     
            End If     
        End With   
    Next   

    Set ctl = Nothing   
    Exit Sub  

    ErrHandler:
        'Handle error
End Sub   

This works as long as the values within the text box are not blank. If one of .Value or .OldValue is null (or nothing — I’m confused on this point) then the inequality fails.

I tried updating the part within With ctl to the following. This allows me to log changes for which one of the values (before or after) was null. The rest of the commented-out stuff is my attempt to record all of the cases where the value is null, but doesn’t change. In other words, the IsNull(ctl) lets everything through, but I couldn’t figure out how to filter the cases of equality back out again.

If .ControlType = acTextBox Then
    If IsNull(ctl) Or .Value <> .OldValue Then
        'If Not (Len(.Value & vbNullString) = 0 And Len(.OldValue & vbNullString) = 0) Then                 

            'If oldValueIsNull Then
            '    varBefore = "--NULL--"
            'Else
            '    varBefore = .OldValue
            'End If

            'If newValueIsNull Then
            '    varAfter = "--NULL--"
            'Else
            '    varAfter = .Value
            'End If

            'Add record of change to logging table

       'End If
    End If
End If

Any help is appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T06:40:36+00:00Added an answer on June 14, 2026 at 6:40 am

    If you are happy to just avoid the whole null issue, which may not suit everyone, you can say

    If .Value & "" <> .OldValue & "" Then 
    

    Which will compare strings.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have come across a scenario where we need to track the setting and
I have verious accounts which need to be kept track of. These accounts are
I have a situation where I need to keep track of all changes to
I have a situation where I should track the FIRST changes applied to a
I have need to pack four signed bytes into 32-bit integral type. this is
I need to track changes created in a directory and also saved the history.
I have a profile page (less than 10k users) and I need to track
So I need to track changes that happen on a Mysql table. I was
Here is the situation: I have a database of 'tickets', and we track changes
Since I'm building a dynamic site, I need to track the changes between pages,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.