Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cannot use parentheses when calling a Sub

Status
Not open for further replies.

onressy

Programmer
Mar 7, 2006
421
CA
can't seem to get rid of this nasty:

Microsoft VBScript compilation error '800a0414'
Cannot use parentheses when calling a Sub

line 263:
Code:
Response.Write( Replace(objRS("FirstName")), ",", "") ) & " " & ( Replace(objRS("LastName")), ",", "") )	' Name


Any suggestions? need more info?
 
Count your parentheses. In particular, replace function takes three arguments, replace(x,y,z). You have replace(x),y,z...
 
response.write replace(objRS("FirstName"), ",", "") & " " & replace(objRS("LastName"), ",", "")

this does the job.

cheers

QatQat

Life is what happens when you are making other plans.
 
Just to clarify on this error...

When calling a subroutine byitself, you cannot use parentheses. ie:

response.write ("HELLO") <<-- WRONG

response.write "HELLO" <<-- CORRECT

this is true with any subroutine..

ie:
Code:
sub CallMe(Somevar as string)

 response.write "You called the CALLME Subroutine."

end sub

The correct way to call this would be:

Code:
CallMe "This Sub"

Cheers,

G.



Oxigen - Next generation business solutions
-----------------------------
Components/Tools/Forums/Software/Web Services
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top