Link to home
Start Free TrialLog in
Avatar of Craig Lambie
Craig LambieFlag for Australia

asked on

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
 
</script>
 
 
 
 
'-----------------------------------------------------------------------------------------------------
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                                              
			else                                                                                                  
					fListIDtoItem = false                                                                             
			end if                                                                                                
                                                                                                            
End Function

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of HuyBD
HuyBD
Flag of Viet Nam image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Craig Lambie

ASKER

Thanks so much, missed that entirely...