PDA

View Full Version : Problem with the "Replace" function


Gary Williams
12-14-2005, 02:42 PM
Hi All,

In an asp page, I need to replace all instances of "&" in company names (coname) with "and".

I have used Replace(coname,"&","and") but when I access this page, I get the following error:

Microsoft VBScript compilation error '800a0414'

Cannot use parentheses when calling a Sub

/companypage.asp, line 145

Replace(coname,"&","and")
-------------------------^

I have tried other combinations of ' and " but no luck yet. How else can I achieve this character replacement?

Regards

Gary

degsy
12-14-2005, 02:54 PM
Assign it to a variable


newVar = Replace(coname,"&","and")

Gary Williams
12-14-2005, 03:44 PM
Hi degsy,

You genius! It worked a treat.

Many thanks

Gary