Adding via a textbox

S

Steve

HYCH

Have a form with 7 Textboxes on ranging from Textbox 1 to textbox 7

Have an 8th textbox that i would like to display the total of all
numbers entered into the textboxes as i go, is this possible?

Did try the following

Textbox8.value = textbox1.value + textbox2.value

This only displayed the numbers i typed i.e.

Textbox1 (entered a '1') and Textbox2 (Entered a '2') the value in
textbox 8 was displayed as 12 rather than 3


Any advice wpuld be appreciated.



Steve
 
J

Jim Rech

Try:

Textbox8.value = Val(textbox1.value) + Val(textbox2.value) +
--
Jim
| HYCH
|
| Have a form with 7 Textboxes on ranging from Textbox 1 to textbox 7
|
| Have an 8th textbox that i would like to display the total of all
| numbers entered into the textboxes as i go, is this possible?
|
| Did try the following
|
| Textbox8.value = textbox1.value + textbox2.value
|
| This only displayed the numbers i typed i.e.
|
| Textbox1 (entered a '1') and Textbox2 (Entered a '2') the value in
| textbox 8 was displayed as 12 rather than 3
|
|
| Any advice wpuld be appreciated.
|
|
|
| Steve
 
S

Steve

Try:

Textbox8.value = Val(textbox1.value) + Val(textbox2.value) +
--

| HYCH
|
| Have a form with 7 Textboxes on ranging from Textbox 1 to textbox 7
|
| Have an 8th textbox that i would like to display the total of all
| numbers entered into the textboxes as i go, is this possible?
|
| Did try the following
|
| Textbox8.value = textbox1.value + textbox2.value
|
| This only displayed the numbers i typed i.e.
|
| Textbox1 (entered a '1') and Textbox2 (Entered a '2') the value in
| textbox 8 was displayed as 12 rather than 3
|
|
| Any advice wpuld be appreciated.
|
|
|
| Steve

Thanks Jim,

did try as you suggested, this only worked once the data has been
entered, was hoping to have the total update as i entered values into
the textboxes as i went.

Thanx again


Steve
 
J

Jim Rech

What event(s) are you using to update Textbox8? To get a realtime update
you'd have to attach this code to the change event of the 7 other textboxes.

A simplified example:

Private Sub TextBox1_Change()
UpdateTotal
End Sub

Private Sub TextBox2_Change()
UpdateTotal
End Sub

Sub UpdateTotal()
TextBox3.Value = Val(TextBox1.Value) + Val(TextBox2.Value)
End Sub


--
Jim
| > Try:
| >
| > Textbox8.value = Val(textbox1.value) + Val(textbox2.value) +
| > --
| >
| >
| > | HYCH
| > |
| > | Have a form with 7 Textboxes on ranging from Textbox 1 to textbox 7
| > |
| > | Have an 8th textbox that i would like to display the total of all
| > | numbers entered into the textboxes as i go, is this possible?
| > |
| > | Did try the following
| > |
| > | Textbox8.value = textbox1.value + textbox2.value
| > |
| > | This only displayed the numbers i typed i.e.
| > |
| > | Textbox1 (entered a '1') and Textbox2 (Entered a '2') the value in
| > | textbox 8 was displayed as 12 rather than 3
| > |
| > |
| > | Any advice wpuld be appreciated.
| > |
| > |
| > |
| > | Steve
|
| Thanks Jim,
|
| did try as you suggested, this only worked once the data has been
| entered, was hoping to have the total update as i entered values into
| the textboxes as i went.
|
| Thanx again
|
|
| Steve
 
S

Steve

What event(s) are you using to update Textbox8?  To get a realtime update
you'd have to attach this code to the change event of the 7 other textboxes.

A simplified example:

Private Sub TextBox1_Change()
    UpdateTotal
End Sub

Private Sub TextBox2_Change()
    UpdateTotal
End Sub

Sub UpdateTotal()
    TextBox3.Value = Val(TextBox1.Value) + Val(TextBox2.Value)
End Sub

--

| > Try:
| >
| > Textbox8.value = Val(textbox1.value) + Val(textbox2.value) +
| > --
| >
| >| > | HYCH
| > |
| > | Have a form with 7 Textboxes on ranging from Textbox 1 to textbox 7
| > |
| > | Have an 8th textbox that i would like to display the total of all
| > | numbers entered into the textboxes as i go, is this possible?
| > |
| > | Did try the following
| > |
| > | Textbox8.value = textbox1.value + textbox2.value
| > |
| > | This only displayed the numbers i typed i.e.
| > |
| > | Textbox1 (entered a '1') and Textbox2 (Entered a '2') the value in
| > | textbox 8 was displayed as 12 rather than 3
| > |
| > |
| > | Any advice wpuld be appreciated.
| > |
| > |
| > |
| > | Steve
|
| Thanks Jim,
|
| did try as you suggested, this only worked once the data has been
| entered, was hoping to have the total update as i entered values into
| the textboxes as i went.
|
| Thanx again
|
|
| Steve

Thx Jim,

Does help when you update :)


Appreciate your assistance with this


Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top