-
Oct 10th, 2008, 04:34 PM
#1
Thread Starter
Hyperactive Member
[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.
-
Oct 10th, 2008, 04:53 PM
#2
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.
-
Oct 10th, 2008, 05:40 PM
#3
Re: VB6 - Runtime error 13: Type Mismatch
Which line of code is causing that error?
-
Oct 11th, 2008, 03:16 AM
#4
Lively Member
Re: VB6 - Runtime error 13: Type Mismatch
Originally Posted by Pradeep1210
Which line of code is causing that error?
Read the first part of his thread post
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;")
-
Oct 13th, 2008, 12:36 PM
#5
Thread Starter
Hyperactive Member
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|