Print Page | Close Window

Cannot use parentheses when calling a Sub

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=5920
Printed Date: 31 March 2026 at 3:01am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Cannot use parentheses when calling a Sub
Posted By: FLATLINE
Subject: Cannot use parentheses when calling a Sub
Date Posted: 23 September 2003 at 12:47pm

HTTP 500.100 - Internal Server Error - ASP error

Error Type:
Microsoft VBScript compilation (0x800A0414)
Cannot use parentheses when calling a Sub
/*********.asp, line ***, column 37
addsubcat(rsCat("cat_id"), strSpaces)
------------------------------------^

That is the error message that I get when I try to execute this function:

<%
Function addsubcat(parentID, strSpaces)

sql = "SELECT * FROM categories WHERE cat_parent = " & parentID & ";"
Set rsCat = Server.Createobject("ADODB.Recodset")
rsCat.open sql, ado

WHILE NOT rsCat.EOF

strNewSpaces = strSpaces & "&nbsp;"

Response.Write("<option value=" & rsCat("cat_id") & ">" & strNewSpaces & rsCat("cat_name") & "</option>")

addsubcat(rsCat("cat_id"), strNewSpaces)
rsCat.MoveNext

WEND
rsCat.close
Set rsCat = Nothing

End Function

%>

The error occurs every time I try to execute that function with more than one parameter. If I delete one of the paremeters from the function header and don't send it when calling it, the error doesn't appear. But I really need the second parameter.

I'm writing this new topic because I started http://forums.webwiz.net/forum_posts.asp?TID=5889&PN=1&TPN=1 - this one but it's too confusing for a rather simpler problem.

Thanks in advance for any help!



-------------
Visit my site: http://darkgreen.service-club.net - DarkGreen HQ



Replies:
Posted By: MorningZ
Date Posted: 23 September 2003 at 1:50pm

so what part is confusing?  the DLL is saying "don't use parathensis"

which means instead of:
addsubcat(rsCat("cat_id"), strNewSpaces)

do:
addsubcat rsCat("cat_id"), strNewSpaces

you can alternatively do:
Call addsubcat(rsCat("cat_id"), strNewSpaces)



-------------
Contribute to the working anarchy we fondly call the Internet


Posted By: FLATLINE
Date Posted: 23 September 2003 at 2:24pm

Thank you so much MorningZ!! It worked!!

I guess I need to learn a bit more about calling functions in ASP lol



-------------
Visit my site: http://darkgreen.service-club.net - DarkGreen HQ


Posted By: HackerNeo
Date Posted: 06 October 2003 at 2:29am

Can Someonw help I'm trying to make an asp page create a file or folder using radio boxes to make my function, create the file on my web server, under the primary dir, using Scripting.FileSystemObject

For more information please contact me

Thanks

Neo



Posted By: fernan82
Date Posted: 06 October 2003 at 2:47am

Should've started a new topic for this....

This is to create a folder called "MyFolder" on the dir where the script is:

Dim objFSO
Dim objMkFolder
Dim strFolderName

strFolderName = Server.MapPath("MyFolder")

Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objMkFolder = objFSO.CreateFolder(strFolderName)
Set objMkFolder = Nothing
Set objFSO = Nothing

More info: http://www.w3schools.com/asp/asp_ref_filesystem.asp - http://www.w3schools.com/asp/asp_ref_filesystem.asp



-------------
FeRnAN
http://www.danasoft.com/">


Posted By: HackerNeo
Date Posted: 06 October 2003 at 2:52am

Thanks FeRnAN  I will try this now!

Neo



Posted By: HackerNeo
Date Posted: 06 October 2003 at 2:53am

 FeRnAN  I would have started a new topic but I get the same error as this topic

 

I will get back to you later

Neo




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net