string manipulation problem - Replace

C

Coz

Hi all,
I'm new to ASP so this is probably a problem caused by me.... but here goes.

I have been pulling some information from an access database (specifically a
postcode)
eg. GL3 2SD, I need to swap the space " " for an plus sign "+" and have been
trying to use this code -

<%Dim ModPostCode
If GetPropertiesRecordset.Fields.Item("AddressPostCode").Value <> ""
Then

ModPostCode=GetPropertiesRecordset.Fields.Item("AddressPostCode").Value
Replace(ModPostCode, " " , "+")
=ModPostCode%>
Some other html........
<%End If%>

But I get this Error -

Microsoft VBScript compilation (0x800A0414)
Cannot use parentheses when calling a Sub
/searchresults.asp, line 354, column 31
Replace(ModPostCode, " " , "+")


I have tested all the lines to make sure that the data is OK and in the
variable 'ModPostCode', I just can't get the Replace command working... Any
ideas... anyone... please....

Cheers
Coz.
 
E

Evertjan.

Coz wrote on 20 jul 2003 in microsoft.public.inetserver.asp.general:
Cannot use parentheses when calling a Sub
Replace(ModPostCode, " " , "+")
=ModPostCode%>

You are using repalce as a sub,
but it is a function where you need to use the result:

ModPostCode = Replace(ModPostCode, " " , "+")

I suppose
 
C

Coz

"Evertjan." wrote in message SNIP
You are using repalce as a sub,
but it is a function where you need to use the result:

ModPostCode = Replace(ModPostCode, " " , "+")

I suppose
SNIP

Cheers mate.... I'm happy 'again' - I did say that it was probably something
I was doing.... Typical!!!

Thanks
Coz.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,734
Messages
2,569,441
Members
44,832
Latest member
GlennSmall

Latest Threads

Top