Repeat afterupdate code

  • Thread starter Thread starter jtfalk
  • Start date Start date
J

jtfalk

Hello,

I have a form that has about 25 inputs for data. I then have about 15 boxes
that I just calculate some numbers so people can see what the effects are as
they enter it. So for every data entry point I have the code behind
AfterUpdate calling

Private Sub Start_number_AfterUpdate()
Call Calculations
End Sub

Private sub Calculations()
.....
End sub

Is there a way to have the calculation boxes all update after any of the
data entry points have without have to put in the afterupdate behind each
one? It works fine the way it is right now but I would like to clean it up.
 
jtfalk said:
Hello,

I have a form that has about 25 inputs for data. I then have about 15
boxes
that I just calculate some numbers so people can see what the effects are
as
they enter it. So for every data entry point I have the code behind
AfterUpdate calling

Private Sub Start_number_AfterUpdate()
Call Calculations
End Sub

Private sub Calculations()
....
End sub

Is there a way to have the calculation boxes all update after any of the
data entry points have without have to put in the afterupdate behind each
one? It works fine the way it is right now but I would like to clean it
up.

Put Calculations() in a standard module and make it public:

Public sub Calculations()

Then in form design view, select all the relevant controls and put this:

=Calculations()

in their AfterUpdate event properties (instead of [Event Procedure])
 
Put Calculations() in a standard module and make it public:

Public sub Calculations()

Then in form design view, select all the relevant controls and put this:

=Calculations()

in their AfterUpdate event properties (instead of [Event Procedure])

nitpick: I think you need to define it as Public Function Calculations(), not
Public Sub.
 
John W. Vinson said:
Put Calculations() in a standard module and make it public:

Public sub Calculations()

Then in form design view, select all the relevant controls and put this:

=Calculations()

in their AfterUpdate event properties (instead of [Event Procedure])

nitpick: I think you need to define it as Public Function Calculations(),
not
Public Sub.

You're right, John. My mistake. Actually, thinking about it, the routine
could stay in the form's module, so long as it's a function.
 
Back
Top