MS Access Forms How to detect if data in field has changed

Posted on 2011-05-11
Last Modified: 2012-06-27
Is there a way to check to see if the value of a combo box or text box has changed?  I have placed my code in the AfterUpdate() event of a control but how can I be sure the user actually changed the data?  For example the user may click on the combo box and actually choose the same selection that it was originally.  In this case I wouldn't want to do anything.  Is there an event I can use that is only trigged if the data actually changes?  

Question by:AronMcD
    LVL 56

    Accepted Solution


     You shouldn't be in AfterUpdate() if it hasn't changed, but if you want to be sure, look at the .OldValue property, which is the original data that was in the control when the record became current.


    Author Comment

    .OldValue works.  I should have thought of that.  Thanks JDettman!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    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

    PaperPort has a feature called the "Send To Bar". It provides a convenient, drag-and-drop interface for using other installed software, such as Microsoft Office. However, this article shows that the latest Office 2016 apps (installed with an Office …
    Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
    With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    779 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

    11 Experts available now in Live!

    Get 1:1 Help Now