Convert string to real number

  • Thread starter Thread starter Jason Frazer
  • Start date Start date
J

Jason Frazer

What commmand can i use to convert a string to a number?
Example "12000458" to 1,200,045.8

Thanks for your help

Jason
 
Jason Frazer said:
What commmand can i use to convert a string to a number?
Example "12000458" to 1,200,045.8

Depending on the size needed...

CInt()
CLng()
CDbl()
CSng()
 
Jason,

How are we to know if 12000458 is not supposed to be 12000458 ( a whole
number), or
120004.58 (2 decimals) or even more decimals?
Is there some criteria?
Or is the string number value ALWAYS 1 decimal?

Anyway, assuming all values (regardless of length) include 1 decimal:

If the number value is a general number value ....
Format(CDbl([TextNumber]/10),"#,###.0")

If the number value is to be used as currency value ....
Format(CCur([TextNumber]/10),"#,###.0")
 
What commmand can i use to convert a string to a number?
Example "12000458" to 1,200,045.8

Thanks for your help

Jason

Try

CDbl([textfield]) / 10.

if you mean that the last digit is consistantly after the decimal.
 
Back
Top