PC Review


Reply
Thread Tools Rate Thread

Add the values of TextBoxes

 
 
Patrick C. Simonds
Guest
Posts: n/a
 
      15th Apr 2009
I am attempting to add these TextBox Values and place the results into
TextBox503 but am having no luck. It will place the value of TextBox1 into
TextBox503 but will not add the values in the other TextBoxes.



Private Sub TextBox1_Change()

TextBox503.Value = CDbl("0" & TextBox1.Value) + CDbl("0" & TextBox2.Value) +
CDbl("0" & TextBox3.Value)
TextBox503.Text = Format(TextBox1.Text, "0.0000")

End Sub

 
Reply With Quote
 
 
 
 
Rick Rothstein
Guest
Posts: n/a
 
      15th Apr 2009
It does that because you used TextBox1 as the argument for the Format
function call instead of TextBox503. This is what you want...

TextBox503.Text = Format(TextBox503.Text, "0.0000")

--
Rick (MVP - Excel)


"Patrick C. Simonds" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
>I am attempting to add these TextBox Values and place the results into
>TextBox503 but am having no luck. It will place the value of TextBox1 into
>TextBox503 but will not add the values in the other TextBoxes.
>
>
>
> Private Sub TextBox1_Change()
>
> TextBox503.Value = CDbl("0" & TextBox1.Value) + CDbl("0" & TextBox2.Value)
> + CDbl("0" & TextBox3.Value)
> TextBox503.Text = Format(TextBox1.Text, "0.0000")
>
> End Sub


 
Reply With Quote
 
Harald Staff
Guest
Posts: n/a
 
      15th Apr 2009
Apologies for disagreeing, I'd do this:

Private Sub TextBox1_Change()
Call Sum503
End Sub

Private Sub TextBox2_Change()
Call Sum503
End Sub

Private Sub TextBox3_Change()
Call Sum503
End Sub

Private Sub Sum503()
Dim DD As Double
DD = Val(TextBox1.Value) + Val(TextBox2.Value) + Val(TextBox3.Value)
TextBox503.Text = Format(DD, "0.0000")
End Sub

Best wishes Harald

"Rick Rothstein" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> It does that because you used TextBox1 as the argument for the Format
> function call instead of TextBox503. This is what you want...
>
> TextBox503.Text = Format(TextBox503.Text, "0.0000")
>
> --
> Rick (MVP - Excel)
>
>
> "Patrick C. Simonds" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
>>I am attempting to add these TextBox Values and place the results into
>>TextBox503 but am having no luck. It will place the value of TextBox1 into
>>TextBox503 but will not add the values in the other TextBoxes.
>>
>>
>>
>> Private Sub TextBox1_Change()
>>
>> TextBox503.Value = CDbl("0" & TextBox1.Value) + CDbl("0" &
>> TextBox2.Value) + CDbl("0" & TextBox3.Value)
>> TextBox503.Text = Format(TextBox1.Text, "0.0000")
>>
>> End Sub

>


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Assigning Values to TextBoxes Public Microsoft Access Reports 1 8th Jun 2008 04:24 PM
Re: Adding values in textboxes? Tom Ogilvy Microsoft Excel Programming 0 27th Jul 2004 08:29 PM
Re: Adding values in textboxes? Bob Phillips Microsoft Excel Programming 0 27th Jul 2004 06:26 PM
inserting values from textboxes... infael Microsoft Access Form Coding 3 8th Apr 2004 04:52 PM
Add values of textboxes together Candee Microsoft Excel Programming 4 5th Dec 2003 07:05 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:43 AM.