I am getting a Runtime Error (Type Mismatch Err.Number=13) on the EXIT FUNCTION line in the following class module... can someone help me??
Public Function get_header_info(strSessionId As String) As ADODB.Recordset
On Error GoTo err:
Dim rs As ADODB.Recordset
Dim cn As ADODB.Connection
Dim cmd As ADODB.CommandSet rs = New ADODB.Recordset
Set cn = New ADODB.Connection
Set cmd = New ADODB.Command
cn.Open gConnectString
rs.CursorLocation = adUseClient
rs.Open "fa_get_header_info '" & strSessionId & "'", cn, adOpenKeyset, adLockOptimistic, adCmdText
Set rs.ActiveConnection = Nothing
Set get_header_info = rs
If rs.EOF And rs.BOF Then
mlngNumOfPOs = 0
Else
mlngNumOfPOs = rs.RecordCount
End If
If cn.State <> 0 Then
cn.Close
Set cn = Nothing
End If
Exit Function
err:
Set cn = Nothing
Set rs = Nothing
End Function
Public Function get_header_info(strSessionId As String) As ADODB.Recordset
On Error GoTo err:
Dim rs As ADODB.Recordset
Dim cn As ADODB.Connection
Dim cmd As ADODB.CommandSet rs = New ADODB.Recordset
Set cn = New ADODB.Connection
Set cmd = New ADODB.Command
cn.Open gConnectString
rs.CursorLocation = adUseClient
rs.Open "fa_get_header_info '" & strSessionId & "'", cn, adOpenKeyset, adLockOptimistic, adCmdText
Set rs.ActiveConnection = Nothing
Set get_header_info = rs
If rs.EOF And rs.BOF Then
mlngNumOfPOs = 0
Else
mlngNumOfPOs = rs.RecordCount
End If
If cn.State <> 0 Then
cn.Close
Set cn = Nothing
End If
Exit Function
err:
Set cn = Nothing
Set rs = Nothing
End Function