From: jtfalk on 12 May 2010 18:45 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.
From: Marshall Barton on 12 May 2010 19:05 jtfalk wrote: >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. The event properties can contain a function call, macro name or, as you are now using, [Event Procedure] To do what you want, replace the [Event Procedure] with: =Calculations() -- Marsh MVP [MS Access]
From: Stuart McCall on 12 May 2010 19:06 "jtfalk" <jtfalk(a)discussions.microsoft.com> wrote in message news:55ADDA6C-9736-40FE-9318-F4FFEB7B97F9(a)microsoft.com... > 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])
From: John W. Vinson on 12 May 2010 21:13 On Thu, 13 May 2010 00:06:19 +0100, "Stuart McCall" <smccall(a)myunrealbox.com> wrote: >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 [MVP]
From: Stuart McCall on 12 May 2010 23:10 "John W. Vinson" <jvinson(a)STOP_SPAM.WysardOfInfo.com> wrote in message news:phkmu5di3q02l7pbmslbbhe7gthfp55rnt(a)4ax.com... > On Thu, 13 May 2010 00:06:19 +0100, "Stuart McCall" > <smccall(a)myunrealbox.com> > wrote: > >>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 [MVP] 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.
|
Pages: 1 Prev: DataSheet Sumary Next: how can I find out number of pages in tab control |