MS Access VBA Forms

Posted on 2011-05-12
Last Modified: 2012-08-13
This question is related to a previous question I asked.

When I'm checking my old value against the new value to see if it changed, when the old value is NULL it doesn't detect a change.  

If g_User_Task = "ReviseOrder" Then
        If Me.cboUDStakePockets.OldValue <> Me.cboUDStakePockets.Value Then
            Me.cboUDStakePockets.Value = Me.cboUDStakePockets.Value & " CHANGED"
        End If
    End If

Open in new window

So when the user opens the form and makes a selection from a combo box that was previously empty, the .oldvalue comes up as NULL and it doesn't detect a change.  Is there a way around this?  
Question by:AronMcD
    LVL 119

    Accepted Solution


    If g_User_Task = "ReviseOrder" Then
            If Nz(Me.cboUDStakePockets.OldValue,"") <> Me.cboUDStakePockets.Value Then
                Me.cboUDStakePockets.Value = Me.cboUDStakePockets.Value & " CHANGED"
            End If
        End If

    Author Comment

    Yep that worked.  Thanks capricorn!

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Join & Write a Comment

    Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
    Recently Microsoft released a brand new function called CONCAT. It's supposed to replace its predecessor CONCATENATE. But how does it work? And what's new? In this article, we take a closer look at all of this - we even included an exercise file for…
    In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
    The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now