MS Access Form Field with Amount Control Source on Update

I have a form in MS Access that has 3 input fields ([Day1], [Day2] and [Day3]) and one field ([Total]) that shows the total of these three fields using ControlSource = [Day1] + [Day2] + [Day3].

Now I want to update another field based on the changes in [Total]. In other words, "when changing" the [Total] field.

I tried to use Change event and AfterUpdate event, but neither of them are triggered when a change happens through the ControlSource.

Of course, I could update the field by running the AfterUpdate code for each of the individual fields, but that seems less elegant.

Is there any event that fires "on change via control source" that I could use for this purpose?

+3


source to share


1 answer


As far as I know, there is no way to fire an event when a calculated control (for example, your Total control) changes its calculated value. I found that there are two approaches that have worked in the past for me:

# 1: do as you said and bind the update of the "other" field to the AfterUpdate events of Day1, Day2, and Day3.



# 2: associate the update of the "other" field with the AfterUpdate method of the form itself. After changes to a record are committed (for example, after a query or a change to records), you have persistent data from which to update.

0


source







All Articles