...

View Full Version : Currency Problem, Displaying without decimal places



JLS1700
12-07-2004, 11:52 PM
Hi I'm pretty new to ASP, and trying to learn it gradually.

I have an ecommerce site using an Access database.

It extracts the products through the ID numbers, as well as the prices.

Everything else is working fine, but the only problem I see to encounter, is that when I save a price as 94.00, it displays in the page as 94... and for example 12.10, that would become 12.1.

I need to try and sort this out, I have been trying to work it out for a few weeks, on and off, and really have come to a blank.

I tried using the round feature with the 2 decimal places, command, hoping it would display as that, but still no luck.

I got the price set as currency in access database, and 2 decimal places, but I'm sure the problem lies in the asp extraction process from the database.

Also a relating problem, I have 2 prices in the database, one ex vat, and one inc vat, I need the ex vat table to automatically work out the ex vat price from the inc vat table, I know you have to use an expression builder,but after hours of fiddling, still stuck on square 1.

I need the "ex vat" table to get the price from "inc vat" table and divide it by 1.175, thats all...

Any help would be greatly appreciated, if I need to post any code, please just say and I will asap.

Thanks a lot :thumbsup:

Jamie

glenngv
12-08-2004, 02:52 AM
Use FormatNumber() (http://www.devguru.com/Technologies/vbscript/quickref/Formatnumber.html). You can also use FormatCurrency() (http://www.devguru.com/Technologies/vbscript/quickref/formatcurrency.html) but the currency symbol used is I think the symbol set in the currency settings in the Regional Options of the server. If is set as the symbol then use FormatCurrency. But if you don't want to depend on the server settings, use FormatNumber.

JLS1700
12-08-2004, 03:03 AM
Thanks for that mate,

I'll give it a go, and hopefully it'll sort my dilemma.

Thanks again.

Jamie

JLS1700
12-08-2004, 03:12 AM
Thanks again buddy, had to modify it slightly because the query came from an access database.

<%=formatcurrency(Recordset1.Fields.Item("SPRICE").Value,2,-1)%>

Thats what worked, and will continue to use :thumbsup:

Thanks again, your a life saver (and time saver)

Jamie



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum