• 05-02-2000, 09:48 AM
john

Hi

I have a textstring that holds a currency. How can I add , for example 1
dollar to this amount??

test="200.50"

I thought that I could convert the string to a double or currency with function
Cdbl or Ccur and after that perform the calculation..like this:
msgbox(Cdbl(test)+1)

The result of this operation is : 20051 ???

this. I want to add a dollar so that the result equals to : 201.50

/John
• 05-02-2000, 12:34 PM
Alan Gillott
Either
msgbox(CCur(test)+100)
or
msgbox(CCur(test)+CCur(1))

john <jonasjohansson70@hotmail.com> wrote in message
news:390edcc1\$1@news.devx.com...
>
> Hi
>
> I have a textstring that holds a currency. How can I add , for example 1
> dollar to this amount??
>
> test="200.50"
>
> I thought that I could convert the string to a double or currency with

function
> Cdbl or Ccur and after that perform the calculation..like this:
> msgbox(Cdbl(test)+1)
>
> The result of this operation is : 20051 ???
>

handle
> this. I want to add a dollar so that the result equals to : 201.50
>
> /John

• 05-02-2000, 01:03 PM
Al Mowbray

if test = "200.50"

CCur(test) + 1
will give 201.5 which you can then format as you like.

Al Mowbray

"john" <jonasjohansson70@hotmail.com> wrote:
>
>Hi
>
>I have a textstring that holds a currency. How can I add , for example 1
>dollar to this amount??
>
>test="200.50"
>
>I thought that I could convert the string to a double or currency with function
>Cdbl or Ccur and after that perform the calculation..like this:
>msgbox(Cdbl(test)+1)
>
>The result of this operation is : 20051 ???
>

handle
>this. I want to add a dollar so that the result equals to : 201.50
>
>/John

• 05-04-2000, 02:08 AM
Jim Edgar
John --

The code you included works fine on my system. The only way I could
reproduce your problem was to change the "." to a comma:

test = "200,50" ' note the comma instead of a period

In this case I got 20051, when I changed the value to "200.50" I got 201.5

You might try:

debug.print test

to see the value of test or check your regional settings to see if anythings
up.

Hope it helps

Jim Edgar

"john" <jonasjohansson70@hotmail.com> wrote in message
news:390edcc1\$1@news.devx.com...
>
> Hi
>
> I have a textstring that holds a currency. How can I add , for example 1
> dollar to this amount??
>
> test="200.50"
>
> I thought that I could convert the string to a double or currency with

function
> Cdbl or Ccur and after that perform the calculation..like this:
> msgbox(Cdbl(test)+1)
>
> The result of this operation is : 20051 ???
>