Using Ccur function - type mismatch error

Hi,I am trying to use Ccur function to convert a string, but I got Type Mismatch error.

Basically, I have a currency in French format as 2089,98

Now, I want to convert it to English Format as 2089.98

In order to simulate my machine as French machine, I changed the Data format of my local machine to French(Canada).

So I am using these codes:

I got that error when execuate this code:

convnum=Ccur(bigstr)


Print “before convert:” + Cstr(FreNum)

Dim str1 As String

Dim str2 As String

Dim bigstr As String

Dim convnum As Currency

str1=Strleft(Cstr(FreNum),",")

Print "str1:" + str1

str2=Strright(Cstr(FreNum),",")

Print "str2:" + str2

bigstr=str1+"." + str2

Print "bigstr:" + bigstr

convnum=Ccur(Cdbl(bigstr))   -- popup Type Mismatch error.

Basically, from the design help, to make it simple.

I created a button with this simple code:


dim pricestr as string

dim realprice as currency

pricestr=“12.99”

realprice=ccur(pricestr) ’ got Type mismatch error in French(Canada) setup.

But I do not have that problem if I change the setup to English(Canada) setup in my local machine. the realprice coverted properly,


Any ideas?

Subject: Using Ccur function - type mismatch error

The basic problem is you’ve got a number stored in a text field (like storing a date in a text field - work great as long as everyone is using the same format).

You’ve changed your regional setting to Canada (French) therefore if you call CCur it expects the number to be in the format ###,## (where comma is the decimal place holder).

You cannot “force” Lotus to do a conversion just because you feed it a period as the decimal place. (No more than you can force lotus notes to understand the date format mm/dd/yyyy if your regional settings are yyyy-mm-dd).

A work around is if you know your number always has two decimal places then check the 3rd character from the right. See if it’s a comma (“French”) or period (“English”)

I’m trying to remember what the French use for their thousand seperator and if that will cause a problem with CDbl. Either way this give you the “idea” on how to get around it.

Dim WholeNum As String

Dim Decimal As String

Dim TheNum As Double

decimalmarker = Left(Right(TextNum,3),1) ’ You could put in a check to make sure it’s either a comma or period.

if decimalmarker = “,” or decimalmarker = “.” then

 WholeNum = Left(TextNum, (Length(TextNum) - 3) )

 Decimal = Right(TextNum,2)

 TheNum = CDbl(WholeNum) + CDbl(Decimal)/100.0

End If

Subject: RE: Using Ccur function - type mismatch error

The thousands separator, if present, will be a space if the decimal “point” is a comma.

Subject: RE: Using Ccur function - type mismatch error

Hi,Thank you so much for both of your help,

Yes, I am trying to use the similar way to solve it.

Basically, I am using instr to judge the comma(french machine) or English machine(dot), and do the converstion for French machine only.

It is not that hard,

Thanks a lot again for the help.

Subject: RE: Using Ccur function - type mismatch error

Why aren’t you storing the number as a number and then you won’t have this problem?