[Webinar] Streamline your web hosting managementRegister Today

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1444
  • Last Modified:

Function works in ASP, but Type Mismatch in VBScript??

Hi Experts,

I have a function that I can get to work fine in ASP, but when I try to call it from a script (vbscript) it doesn't work??
Error is Type Mismatch
If I remove the brackets it gives me Object Expected
If I add "" around the function variable same error

If you could let me know what the problem might be?

Thanks in advance...
<!--#include Virtual="/EUCApps/MoneyMarkets/includes/inc_functions.asp"-->
<!--#include Virtual="/EUCApps/MoneyMarkets/includes/inc_db_MMDesk_connect.asp"-->
response.write "Time Value " & Timevalue(now())
response.write "<br>" & Session("UserAccessLevel")
response.write "<br>" & Session("MMDeskAccessLevel")
response.write "<br>" & Session("PersonName")
response.write "<br>" & Session("Initials")
response.write "<br>" & Application("Environ")
'Response.write "<br>" & FormatDate(Now(), 1)
response.write "<br><br>" 
response.write fListIDtoItem(25)
response.write "<br><br>" 
response.write fListItemtoID("Confirmed")
response.write "<br><br><INPUT type=button value=click onclick=press()>"
<script language="VBScript" type="text/VBScript">
'msgbox fListIDtoItem("25")
function press()
msgbox fListIDtoItem (25)
end function
Function fListIDtoItem(strID)                                                                               
dim strSQLfunc
dim rsGetList                                                                                       
	Set rsGetList = CreateObject("ADODB.Recordset")                                                    
		strSQLfunc = "SELECT vchListItem " & _                                                                      
						 "FROM tblLists " & _                                                                           
						 "WHERE intListItemID=" & strID                                                               
			rsGetList.Open strSQLfunc, objSQLMMDeskConn, 0, 1
			If Not rsGetList.EOF then                                                                             
					fListIDtoItem = rsGetList.Fields("vchListItem").value                                              
					fListIDtoItem = false                                                                             
			end if                                                                                                
End Function

Open in new window

Craig Lambie
Craig Lambie
  • 2
1 Solution
sure, the code when you call function is client script, (like javascript)
So you cant call the server script (your function)
Take a look at ajax to solve it
Craig LambieAuthor Commented:
Thanks so much, missed that entirely...

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now