Calculating total in macro?

E

escudolm

I am trying to get the total of certain textboxes on my "frmentry". I have
the macro's working properly to put certain amounts in the textboxes when
toggle buttons are pressed, but the total never shows anything. All the
textboxes are updated instantly when I push a toggle button, so that is fine.
But my macro for the total, never does anything. It just stays blank. I
have it adding up all the textboxes: txtmailoutamount, txtshuttleamount,
txtdinneramount, txtentryamount, and txtxxl (these are the textboxes getting
updated by the macros). The total is supposed to be updated as certain
toggle buttons are pushed. Any ideas why it is not doing anything?
 
R

Rick B

Personally, I'd not go through the hoops of building a macro, I'd just build
a simple statement in code and put it in the appropriate event. When do you
want it to fill in the total?
 
E

escudolm

Well, I have the macro running on the afterupdate event in the textbox for
the total. I want the the total textbox to be updated all the time. So if a
person pushes a toggle button, the amount goes into that textbox and then the
total textbox shows that amount plus any other amount in the other textboxes.
And if they take off something by pushing another toggle button, then the
new total is put in the total textbox. Hopefully this makes sense.
 
R

Rick B

I could be wrong, but I think AFTERUPDATE runs after you save the record.
It look like ONCHANGE, might work, or simply add it to the other macros.

If Macro1 puts some value in the total box, instead, have it put that value
plus whatever else. In other words, don't have one macro run and then
expect another to run as soon as that one is done, just do it all in one
macro.

Again, if it were me, I'd get rid of all the macros and just write a simple
one or two line code. Macros have limited ability, and they clutter up the
database. Just write code.
 
E

escudolm

Well, I was going to just write code but wanted to try a macro since I
normally don't mess with them too much. Actually I got it to run perfectly
now. I just had to put the calculation in the control source for the
textbox. Thanks.
 
Top