[RESOLVED] VB6 - Runtime error 13: Type Mismatch
Gentlemen,
I have one annoying error and I have looked and looked and can't find the mismatch.
The code below gave the above error:
Code:
Set rsin = Dbs.OpenRecordset("SELECT tblUnclaimed.PassNumber, tblUnclaimed.EmployeeName, EmployeeInfo.Address, EmployeeInfo.City, EmployeeInfo.State, EmployeeInfo.ZIP, EmployeeInfo.L3, EmployeeInfo.L5, tblUnclaimed.Original_Check_Date, tblUnclaimed.Amount_of_Check, EmployeeInfo.Status " _
& "FROM EmployeeInfo RIGHT JOIN tblUnclaimed ON (EmployeeInfo.L1 = tblUnclaimed.L1) AND (EmployeeInfo.Pass_Number = tblUnclaimed.PassNumber) " _
& "WHERE (((EmployeeInfo.Status) Like 'N*') AND ((EmployeeInfo.Union_Code) In ('00','01','32','33')) AND ((tblUnclaimed.Status) In ('A','E','U'))) OR (((EmployeeInfo.Union_Code) In ('00','01','32','33')) AND ((tblUnclaimed.Status) In ('A','E','U')) AND ((Len([EmployeeInfo].[Status]))=1)) " _
& "ORDER BY EmployeeInfo.L3, EmployeeInfo.L5, tblUnclaimed.PassNumber, tblUnclaimed.Original_Check_Date;")
This is my entire module so far:
Code:
Private Sub cmdExecproc_Click()
Dim rsin As Recordset
Dim xlApp As New Excel.Application
Dim xlWbk As Workbook
Dim xlWksht1 As Worksheet
Dim xlWkSht2 As Worksheet
Dim xlWkSht3 As Worksheet
Dim xlWkSht4 As Worksheet
Dim Dbs As Database
Dim DbPath As String
Dim DbName As String
Dim StrSQL As String
Dim Qdef As QueryDefs
DbPath = "\\Livctrls03-08\Data1\APP\UNCLAIMW\UCCTest\Databases\"
DbName = "Unclaimed Checks.mdb"
'Open Database/Recordset:
'------------------------
Set Dbs = OpenDatabase(DbPath & DbName)
Set rsin = Dbs.OpenRecordset("SELECT tblUnclaimed.PassNumber, tblUnclaimed.EmployeeName, EmployeeInfo.Address, EmployeeInfo.City, EmployeeInfo.State, EmployeeInfo.ZIP, EmployeeInfo.L3, EmployeeInfo.L5, tblUnclaimed.Original_Check_Date, tblUnclaimed.Amount_of_Check, EmployeeInfo.Status " _
& "FROM EmployeeInfo RIGHT JOIN tblUnclaimed ON (EmployeeInfo.L1 = tblUnclaimed.L1) AND (EmployeeInfo.Pass_Number = tblUnclaimed.PassNumber) " _
& "WHERE (((EmployeeInfo.Status) Like 'N*') AND ((EmployeeInfo.Union_Code) In ('00','01','32','33')) AND ((tblUnclaimed.Status) In ('A','E','U'))) OR (((EmployeeInfo.Union_Code) In ('00','01','32','33')) AND ((tblUnclaimed.Status) In ('A','E','U')) AND ((Len([EmployeeInfo].[Status]))=1)) " _
& "ORDER BY EmployeeInfo.L3, EmployeeInfo.L5, tblUnclaimed.PassNumber, tblUnclaimed.Original_Check_Date;")
Any help will be appreciated.
Giftx.
Re: VB6 - Runtime error 13: Type Mismatch
I don't see it right off either. I would guess it isn't your sql statement itself. If it was, I would expect an db-generated syntax error or something else.
1. Does the database open? Do you get an error on the Set Dbs line?
2. If not, what references do you have in your project. Do you have more than one DAO reference, do you also have ADO references? If so, remove the ones you are not using.
Re: VB6 - Runtime error 13: Type Mismatch
Which line of code is causing that error?
Re: VB6 - Runtime error 13: Type Mismatch
Quote:
Originally Posted by Pradeep1210
Which line of code is causing that error?
Read the first part of his thread post ;)
Quote:
The code below gave the above error:
Code:
Set rsin = Dbs.OpenRecordset("SELECT tblUnclaimed.PassNumber, tblUnclaimed.EmployeeName, EmployeeInfo.Address, EmployeeInfo.City, EmployeeInfo.State, EmployeeInfo.ZIP, EmployeeInfo.L3, EmployeeInfo.L5, tblUnclaimed.Original_Check_Date, tblUnclaimed.Amount_of_Check, EmployeeInfo.Status " _ & "FROM EmployeeInfo RIGHT JOIN tblUnclaimed ON (EmployeeInfo.L1 = tblUnclaimed.L1) AND (EmployeeInfo.Pass_Number = tblUnclaimed.PassNumber) " _ & "WHERE (((EmployeeInfo.Status) Like 'N*') AND ((EmployeeInfo.Union_Code) In ('00','01','32','33')) AND ((tblUnclaimed.Status) In ('A','E','U'))) OR (((EmployeeInfo.Union_Code) In ('00','01','32','33')) AND ((tblUnclaimed.Status) In ('A','E','U')) AND ((Len([EmployeeInfo].[Status]))=1)) " _ & "ORDER BY EmployeeInfo.L3, EmployeeInfo.L5, tblUnclaimed.PassNumber, tblUnclaimed.Original_Check_Date;")
Re: VB6 - Runtime error 13: Type Mismatch
LaVolpe,
thank you for your geniune observation and input. Yes, I was using both DAO and ADO and it didn't like it. I removed the ADO and it worked.
Thanks again.
Giftx.