Forums

This topic is locked

Properly display currency - decimal rounding fixed

Posted 19 Aug 2007 20:46:32
1
has voted
19 Aug 2007 20:46:32 Mike Mitchell posted:
I'm using Dreamweaver 8 to build a site that tracks how much money people have in their account. The Access 2000 database uses a column formatted to "Currency" (not number). When entered, the data looks fine. BUT, when sent to the browser, it drops the second decimal place if it equals zero.

ex.
12.25
12.3
15.55
111.5

SOLUTION: Use the FormatCurrency function in VB Script to force your data to display correctly. Create your page as normal. Drag the data field to the correct location, then open the code view and make the following edits, <font color=red>which are indicated in red.</font id=red>

&lt;%= <font color=red>FormatCurrency</font id=red>(rsListMembers.Fields.Item(&quot;AccountBallance".Value<font color=red>,2</font id=red>%&gt;

NOTE: This method will also add the dollar sign (if you're in the US), and Euro sign if you're over there. This is pulled from your local user settings in your computer.

Here's the article where I found the solution: www.drdev.net/article04.asp
Hope this helps!

Reply to this topic