Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Jason Perry   on Dec 21 In MS Office Category.

  
Question Answered By: Dalpat Student   on Dec 21

The problem is that you've assigned the sub to the TOTAL textbox, so
that when the TOTAL changes, then calculate the TOTAL... not exactly
what you're wanting.
What I would do, is rename your Private sub to Sub Calc_Total() (or
something like that) and move it to a Module.
Then, for each of your textboxes, create a change event to call  the
new sub, like:
Private Sub txtOpt1Yards_Change()
Calc_Total
End Sub
Private Sub txtOpt2Yards_Change()
Calc_Total
End Sub

then, whenever any of the textbox values  change, the total gets
re-calcualted.

Warning: the change event is called for EACH KEYSTROKE
That means that if you already have 100 and 200 in boxes  1 and 2,
then plan to enter the value of 224 into the
third textbox: when you hit 2, the total will update to 302,
then you hit another 2 (for 22), the total will update to 322.
then you hit the final number (4) the total will update to 524.

If this is adequate, then you're good to go.
If not, you might consider using the Exit event, instead of the
Change event.
With the Exit event, the total will be updated when the user moves
the type-in bar to another box.

Share: 

 

This Question has 2 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Sum values entered into text boxes Or get search suggestion and latest updates.


Tagged: