Number of Decimal Places displayed

Hi,

I'm grabbing some variables and doing some maths with them for the results to then be displayed. I've got this working fine. But if I have two prices, e.g £16.50 and £6.00, take them away from each other, I am getting the result of £10.5 and I would like £10.50 if possible?

Any ideas anyone?

Thanks,
AJ
if pricewas="n/a" then
pricesave="n/a"
else
pricesave=pricewas - costsqm
end if

Open in new window

LVL 2
Dave RobinsonAsked:
Who is Participating?
 
mraluminumsidingConnect With a Mentor Commented:
Duh, wrong function.
pricesave = FormatNumber((pricewas - costsqm), 2)

Open in new window

0
 
mraluminumsidingCommented:
That looks like VB, so:


pricesave = Round(pricewas - costsqm), 2)

Open in new window

0
 
Dave RobinsonAuthor Commented:
Thanks for the ideas mraluminumsiding Unfortunately i just get this error with that code
Microsoft VBScript compilation  error '800a0401'
 
Expected end of statement
 
/index.asp, line 266
 
costsqm2= FormatNumber(tilespersqm2 * price2), 2)
---------------------------------------------^

Open in new window

0
 
mraluminumsidingCommented:
You need an extra parentheses in the beginning, right after FormatNumber.
0
 
Dave RobinsonAuthor Commented:
Sorry its taken me a while to get back to your reply on this mraluminumsiding, I've been away. Thanks for the reply though.

What do you mean by parentheses? I'm not so hot on ASP, nor SQL Server.

Cheers
0
All Courses

From novice to tech pro — start learning today.