formatnumber without comma


For some strange reason a banking system Im sending a number to will not accept commas.
so if I send 1,200.50 it fails
However if I send the number without sending it as formatnumber(number,2) it also fails because the decimals arent correct eg theyd be 1200.5
Basically it needs to be a number with correct decimals and no commas for values > 999
Any ideas to get around this please?
Who is Participating?
Dave BaldwinConnect With a Mentor Fixer of ProblemsCommented:
From W3Schools demo page.

<script type="text/vbscript">

document.write(FormatNumber(20000,2,0,0,0) & "<br />")



Open in new window

lgreallyAuthor Commented:
Thanks Dave
I implemented
mAmount = FormatNumber(mAmount,2,0,0,0)
mAmount = FormatNumber(mAmount,2)

However, I still get 1,350.50 ie including a comma (which fails)
rhawkConnect With a Mentor Commented:
If you get the right number (the ending 0) but want to rip out the comma then add this:
Take the good number with the comma and pull it out.
Dave BaldwinFixer of ProblemsCommented:
I left the second example in there just for the comparison.  All you want to actually use is "mAmount = FormatNumber(mAmount,2,0,0,0)".  Keeping the second version just puts it back the way it was.
lgreallyAuthor Commented:
I'd been reluctant to try the replace function thinking it would be picked up as a string but the banking system seems to like it.

Just to clarify my code is:

mAmount = FormatNumber(mAmount,2,0,0,0)
mAmount = FormatNumber(mAmount,2)

if instr(1,cstr(mAmount),",") then
    mAmount = replace(mAmount,",","")
end if

Thanks guys
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.