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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Type Mismatch problem with call to VBscript function

Status
Not open for further replies.

RickLiebespach

Programmer
Sep 29, 2003
85
0
0
US
I was wondering if anyone could help me resolve this error message.

Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch: 'MyTest'
/rick/omnia_act_initializations.inc, line 59

here's the section of /rick/omnia_act_initializations.inc
-------------
IF MyTest("CONTACTS") = TRUE THEN
response.write("after call to MyTest returns TRUE")
ELSE
response.write("after call to MyTest returns FALSE")
END IF

-------------

Line 59 is, of course,
IF MyTest("CONTACTS") = TRUE THEN



The MyTest function is defined as
-------------
<SCRIPT LANGUAGE=&quot;vbscript&quot;>
Function MyTest(cTable)
Dim lReturnValue
lReturnValue = TRUE

MyTest = lReturnValue
End Function
</SCRIPT>

-------------

Can anyone could help me resolve this error message?

TIA,
Rick
 
It looks like you are making the function a client side function instead of a server side function. Therefore, when you call the function on the server side it can't be found.

Replace the <SCRIPT></SCRIPT> tags with <% and %> so that the function is a server side function.

<%
Function MyTest(cTable)
Dim lReturnValue
lReturnValue = TRUE

MyTest = lReturnValue
End Function
%>


 
bernlaw's post will probably solve it for you, this is just an addendum for cleaner code:
Code:
IF MyTest(&quot;CONTACTS&quot;) = TRUE THEN

can easily be expressed as
Code:
IF MyTest(&quot;CONTACTS&quot;) THEN

as MyTest() will return true or false :)

It will basically make no difference though :D

Posting code? Wrap it with code tags: [ignore]
Code:
[/ignore][code]CodeHere
[ignore][/code][/ignore].
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top