Field Old Value

Posted on 2012-09-16
Last Modified: 2012-09-16
I am trying to get an event to fire only when a fields data is changed.

When a user chooses a (Text) value from a combo box I want to highlight certain fields fonts in red when the data in the combo's field is different from the previous value. I cannot use after update because users sometimes look at the options in the combo and decide the original value was the correct one. in which case I want nothing to happen. Also if after update is used the first selection will trigger the event.

I only want to fire the event if the new data chosen is different from the existing data except where the original value was null. I have tried OldValue but that has some very strange effects depending on what mood access is in.
Question by:DatabaseDek
    LVL 61

    Expert Comment

    The Old value of a field will work as expected between the time you update the individual control and the time you update the record as a whole.  So after changing the combo and before moving off the record or forcing a record save.

    An alternative to using the OldValue property that might work for you is to compare the .Text Property to the .Value property.  You would have to do this in the combo's Change Event.

    Take a look at this article:
    LVL 61

    Accepted Solution

    As a side note, what you are asking for is not entirely clear.

    If you are trying to differentiate between an edited value and the previous value of that field *while the user is still editing the record, before the record is saved*, you can use a couple of different methods involving OldValue or the .Text property.

    However if you need to differentiate between a current value and a previous value after the record is saved, those methods won't work.  If this is what you are trying to do, you would need a history table to store previous values.

    Author Closing Comment

    Part of the problem (Having read your post) is, surprisingly, me. I like everything saved as I am doing it. So if another field refers to the first field in any way I like to save it with either Me,dirty or refresh. Not sure what the difference is?

    Thank you for solving a very frustrating problem

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Join & Write a Comment

    Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
    Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
    Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
    In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

    731 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