Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 27th, 2004, 04:36 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 347
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Adam H-W
Default cannot use parentheses when calling a sub

Hi

I get this error message:

Microsoft VBScript compilation error '800a0414'

Cannot use parentheses when calling a Sub

Response.Write(replace(strCol3), vbcrlf, "<br>"))
------------------------------------------------^

this is my raw code:

<%=replace(strCol3), vbcrlf, "<br>")%>

can anyone tell me how to fix this?

thanks

Adam


 
Old October 27th, 2004, 06:40 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

The following function will do what you are trying to do and more, i wrap it round text strings when inserting:

  Function tweakText(theText)
    tweakText = ""
    on error resume next
    tweakText = CStr(theText)
    if (len(tweakText) > 0) Then
      tweakText = Replace(tweakText, """", "&quot;", 1, -1, 1)
      tweakText = Replace(tweakText, "'", "''", 1, -1, 1)
      tweakText = Replace(tweakText, vbcrlf, "<br>", 1, -1, 1)
    end if
  End Function

  dim strCol3
  strCol3 = "The All Blacks gratest rugby team in th world's"

  response.write tweakText(strCol3)

NOTE:
;;; <%=replace(strCol3), vbcrlf, "<br>")%>
you have only 1 ( but have two )) - these must match up


Wind is your friend
Matt
 
Old October 28th, 2004, 02:09 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 347
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Adam H-W
Default

thanks Matt

but I get a syntax error on the first line of the function?

Microsoft VBScript compilation error '800a03ea'

Syntax error

Function tweakText(thetext)
^


Also, what do I replace 'thetext' with? my variable - strCol3?

thanks

Adam

 
Old October 28th, 2004, 07:22 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

Adam H-W

Post your code, if possible indicating which line number. The code I posted runs fine for me, Your problem is probably:

You are not passing a string, it must be a string.

;;;;Also, what do I replace 'thetext' with? my variable - strCol3?

I have set a variable to a 'string':
strCol3 = "The All Blacks gratest rugby team in th world's"

This variable is passed into the function, the function gets called:
tweakText(strCol3)

Then the function initiates:
Function tweakText(theText)
theText holds the string contained in the variable strCol3

Post your code that genrates the error






Wind is your friend
Matt
 
Old October 29th, 2004, 01:52 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Adam,
Quote:
quote:Response.Write(replace(strCol3), vbcrlf, "<br>"))
Can you count the number of OPENED and CLOSED paranthesis there, which doesn't tally. You seem to close the REPLACE function just after strCol3, so that results in not interpretting VBCRLF, as you wanted. It should look like...
Code:
Response.Write(replace(strCol3, vbcrlf, "<br>"))
Hope that helps.
Cheers!

_________________________
- Vijay G
Strive for Perfection
 
Old October 29th, 2004, 03:41 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 347
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Adam H-W
Default

great, thanks guys - all sorted






Similar Threads
Thread Thread Starter Forum Replies Last Post
calling a sub collatos BOOK: Beginning Microsoft Visual Basic 2008 ISBN: 978-0-470-19134-7 1 October 3rd, 2008 02:07 PM
Calling Applet !!! dpkbahuguna Classic ASP Basics 0 December 25th, 2006 02:23 AM
Calling C# from C NoXuS C# 10 May 12th, 2006 10:40 AM
Sub Parentheses dpkbahuguna Beginning VB 6 7 March 11th, 2006 07:22 AM
Calling functions ejmichaud Access VBA 2 July 16th, 2004 10:03 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.