...

View Full Version : Expected identifier Error



DigitalFusion
02-27-2006, 09:53 PM
Ok, I cant figure this out, and I am sure it is somethign stupid cause I am over tired. I am getting this error:

Error Type:
Microsoft VBScript compilation (0x800A03F2)
Expected identifier
/intranet/sales_cservice/ezpricer/pricerfunctions.asp, line 3, column 4
Sub Currency(str)
---^

This is the sub:
Sub Currency(str)
if str <>"" then
str = FormatCurrency(str,2)
End Sub

What am I missing here?

Brandoe85
02-27-2006, 10:09 PM
Currency is more than likely a reserved word and you cannot use it's name. you also need to put your if statement on one line if you're not going to put an end if, I also think you want to use a function instead and return the value:


Function NewName(str)
if str <>"" then
str = FormatCurrency(str,2)
end if
NewName = str
End Function

' or if you want to use a one-liner
Function NewName(str)
if str <>"" then str = FormatCurrency(str,2)
NewName = str
End Function


Good luck;



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum