Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

error: cannot use parenthese when calling a sub

Status
Not open for further replies.

lucyc

Programmer
Mar 1, 2002
62
US
In my asp I have a include file (UserIDMaintenance.vbs) which contain a subroutine like this :
<SCRIPT language=&quot;VBSCRIPT&quot;>

Sub AddNewUser(strFacilityNo, strUserID)
.
.
.
End Sub
</SCRIPT>

Here is my asp:

<!--#Include File=&quot;UserIDMaintenance.vbs&quot; -->
<FORM>
<%
.
.
.
.
Response.Write &quot;<P Align=Center><Input Type=Button Value=&quot;&quot;Add New User&quot;&quot; Name=cmdAddNewUser onClick=&quot;&quot;AddNewUser('&quot; & strFacilityNo & &quot;','&quot; & strUserID & &quot;')&quot;&quot;> &quot;
%>
</FORM>

I keep getting &quot;Cannot use parenthese when calling a sub&quot; error message. Why???? What is wrong. Please help. Thanks in advance.
 
change it to a function

_________________________________________________________
for the best results to your questions: FAQ333-2924
01001111 01101110 01110000 01101110 01110100
onpnt2.gif
[/sub]
 
Just as test try writing your button out in just html

<P Align=Center><Input Type=Button Value=&quot;Add New User&quot; Name=&quot;cmdAddNewUser&quot; onClick=&quot;AddNewUser('<%=strFacilityNo%>','<%=strUserID%>')&quot;>



 
onpnt and GaryC123,

Thanks for your quick response.

onpnt,

Do you mean that I can't use sub ??

GaryC123,

Tested it and it shows the correct value for both variables.

 
Yeah, people get away with stuff like:

MySub(&quot;fruity colors&quot;)

But then when they try to use a Sub w/two parameters like:

MyUdderSub(&quot;wham&quot;, &quot;bam&quot;)

They get confused when the syntax error message hits them. The bad thing is that:

MySub(&quot;fruity colors&quot;)

... and,

MySub &quot;fruity colors&quot;

... are not the same thing and in some cases the first version will have unexpected side-effects. Especially when the thing being passed to the Sub is a variable and the Sub has a ByRef parameter.

Microsoft didn't help with all the errors of this nature in their documentation on VBScript. Bill has to stop letting the C weenies muck about in product documentation for languages that aren't descended from C. I have sent them 16 bug reports on errors in the 5.6 scripting docs already.

Know what's scary? They are actually pretty good about accuracy. The Netscape docs are a horror - but then again AOL sort of gutted that outfit of staff a while back too and they don't have the resources Microsoft has.
 
couldn't you also CALL the sub? Like this...

Response.Write &quot;<P Align=Center><Input Type=Button Value=&quot;&quot;Add New User&quot;&quot; Name=cmdAddNewUser onClick=&quot;&quot;CALL AddNewUser('&quot; & strFacilityNo & &quot;','&quot; & strUserID & &quot;')&quot;&quot;> &quot;
%>

Get the Best Answers! faq333-2924
Is this an asp FAQ? faq333-3048
Tek-Tips Best Practices: FAQ183-3179
 
dilettante,

Thanks a lot. It works once I took out the parentheses.
 
Heh, dilettante, I'm glad your posting over in this pasture more, nice catch.

*snickers* C weenies

Heh

-Tarwn

01010100 01101001 01100101 01110010 01101110 01101111 01101011 00101110 01100011 01101111 01101101
29 3K 10 3D 3L 3J 3K 10 32 35 10 3E 39 33 35 10 3K 3F 10 38 31 3M 35 10 36 3I 35 35 10 3K 39 3D 35 10 1Q 19
Get better results for your questions: faq333-2924
Frequently Asked ASP Questions: faq333-3048
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top