Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jan 2006
    Posts
    33
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Expected identifier Error

    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?

  • #2
    teh Moderatorinator
    Join Date
    Sep 2004
    Location
    USA
    Posts
    2,472
    Thanks
    4
    Thanked 40 Times in 40 Posts
    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:
    Code:
    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;


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •