Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Whole number to decimal problem

Status
Not open for further replies.

bob123bobcom

Programmer
Sep 30, 2002
1
US
I am pulling a data field like 1704370 but i need it to be like 1.704370. Any help to do this in my vbscript/asp page.
 
Hi,
Try the following VB Script:

msgbox(FormatNumber(1704370,Len(1704370)-1))

Check out the FormatNumber function for more options. Hope it helps. Let me know what happens.
With regards,
PGK
 
Hmmmmmm,

Not familiar w/ the function (method). Help list it as an XML function, not vb?

MichaelRed
m.red@att.net

There is never time to do it right but there is always time to do it over
 
Hi MichaelRed,
It is a VB Script function. Hope it helps. Let me know what happens.
With regards,
PGK
 
??? [/b][/i][/u]*******************************************************
General remarks:
If this post contains any suggestions for the use or distribution of code, components or files of any sort, it is still your responsibility to assure that you have the proper license and distribution rights to do so!
 
If you're working with values, then you should use:

1704370 = 1.704370 * (10^6)
1.704370 = 1704370 / (10^6)
so,
result = number / (10^exp)
Code:
lngNumber = Val(txt.Text)
strNumber = Str$(lngNumber)
intExp = Len(strNumber) - 2
dblNumber = lngNumber / (10 ^ intExp)
lbl.Caption = dblNumber

Oak
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top