PC Review


Reply
Thread Tools Rate Thread

Adding vs Concatenate

 
 
Maxi
Guest
Posts: n/a
 
      30th Aug 2007
Private Sub CmbBxOpening_Change()
TxtBxWTOpening = Format(CmbBxOpening.Value / 3 * 5, "0.00")
Tscore1.Value = Val(TxtBxWTOpening.Value) + Val(TxbBxWTPolicy.Value)
End Sub

Private Sub CmbBxPolicy_Change()
TxtBxWTPolicy = Format(CmbBxPolicy.Value / 1 * 8, "0.00")
Tscore1.Value = Val(TxtBxWTOpening.Value) + Val(TxbBxWTPolicy.Value)
End Sub


In the Tscore1 textbox, I am getting a concatenation of what is
entered in TxtBxWTOpening and TxtBxWTPolicy.

When I select 1 in the CmbBxOpening combo box, I get 1.67 in
TxtBxWTOpening
When I select 1 in the CmbBxPolicy combo box, I get 8.00 in
TxtBxWTPolicy

when I add them, instead of getting 9.67, i am getting 1.678.00 which
is a concatenation. Can anyone help?

 
Reply With Quote
 
 
 
 
=?Utf-8?B?Sm9lbA==?=
Guest
Posts: n/a
 
      30th Aug 2007
The combobox store the number as text instead of numbers. If you are reading
the values from the combo box you must convert the text to numbers before you
add them. Simply do what you have already done in tthe code posted. Use the
Val function. total = val(Combobox1.text) + val(Combobox2.text)

"Maxi" wrote:

> Private Sub CmbBxOpening_Change()
> TxtBxWTOpening = Format(CmbBxOpening.Value / 3 * 5, "0.00")
> Tscore1.Value = Val(TxtBxWTOpening.Value) + Val(TxbBxWTPolicy.Value)
> End Sub
>
> Private Sub CmbBxPolicy_Change()
> TxtBxWTPolicy = Format(CmbBxPolicy.Value / 1 * 8, "0.00")
> Tscore1.Value = Val(TxtBxWTOpening.Value) + Val(TxbBxWTPolicy.Value)
> End Sub
>
>
> In the Tscore1 textbox, I am getting a concatenation of what is
> entered in TxtBxWTOpening and TxtBxWTPolicy.
>
> When I select 1 in the CmbBxOpening combo box, I get 1.67 in
> TxtBxWTOpening
> When I select 1 in the CmbBxPolicy combo box, I get 8.00 in
> TxtBxWTPolicy
>
> when I add them, instead of getting 9.67, i am getting 1.678.00 which
> is a concatenation. Can anyone help?
>
>

 
Reply With Quote
 
Maxi
Guest
Posts: n/a
 
      30th Aug 2007
thank you so much for your help

On Aug 30, 4:08 pm, Joel <J...@discussions.microsoft.com> wrote:
> The combobox store the number as text instead of numbers. If you are reading
> the values from the combo box you must convert the text to numbers before you
> add them. Simply do what you have already done in tthe code posted. Use the
> Val function. total = val(Combobox1.text) + val(Combobox2.text)
>
>
>
> "Maxi" wrote:
> > Private Sub CmbBxOpening_Change()
> > TxtBxWTOpening = Format(CmbBxOpening.Value / 3 * 5, "0.00")
> > Tscore1.Value = Val(TxtBxWTOpening.Value) + Val(TxbBxWTPolicy.Value)
> > End Sub

>
> > Private Sub CmbBxPolicy_Change()
> > TxtBxWTPolicy = Format(CmbBxPolicy.Value / 1 * 8, "0.00")
> > Tscore1.Value = Val(TxtBxWTOpening.Value) + Val(TxbBxWTPolicy.Value)
> > End Sub

>
> > In the Tscore1 textbox, I am getting a concatenation of what is
> > entered in TxtBxWTOpening and TxtBxWTPolicy.

>
> > When I select 1 in the CmbBxOpening combo box, I get 1.67 in
> > TxtBxWTOpening
> > When I select 1 in the CmbBxPolicy combo box, I get 8.00 in
> > TxtBxWTPolicy

>
> > when I add them, instead of getting 9.67, i am getting 1.678.00 which
> > is a concatenation. Can anyone help?- Hide quoted text -

>
> - Show quoted text -



 
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
RE: Adding suffix to all the values in a field ( concatenate) Dorian Microsoft Access Form Coding 1 20th Jan 2010 09:22 PM
Re: Adding suffix to all the values in a field ( concatenate) Gina Whipp Microsoft Access Form Coding 0 20th Jan 2010 08:22 PM
Concatenate function adding double quotes to both ends of results =?Utf-8?B?U3F0WW9yaw==?= Microsoft Excel Worksheet Functions 0 4th Sep 2007 06:22 PM
Concatenate =?Utf-8?B?SmVmZg==?= Microsoft Excel Misc 4 5th Oct 2005 04:39 PM
I know how to concatenate ,can one de-concatenate to split date? =?Utf-8?B?UVVJQ0sgQk9PS1MgUFJPQkxFTS0=?= Microsoft Excel New Users 1 26th Jul 2005 05:07 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:58 AM.