469,271 Members | 1,000 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,271 developers. It's quick & easy.

string manipulation problem - Replace

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("AddressPostCod e").Value <> ""
Then

ModPostCode=GetPropertiesRecordset.Fields.Item("Ad dressPostCode").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.
Jul 19 '05 #1
2 2699
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

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 19 '05 #2
Coz

"Evertjan." wrote in message news:Xn********************@194.109.133.29...
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.
Jul 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Phrederik | last post: by
32 posts views Thread by tshad | last post: by
4 posts views Thread by WaterWalk | last post: by
15 posts views Thread by morleyc | last post: by
3 posts views Thread by Henri | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.