Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Question on Type Mismatch error 1

Status
Not open for further replies.

cojiro

MIS
Mar 20, 2003
62
US
Can anyone tell me why I'm getting the "Runtime error 13: Type Missmatch" when trying to run the following code...

Code:
Public Sub CreateAuditTable()
   ' Dim MasterRS As Recordset
    Dim AuditIDs As Recordset
    Dim TranCounter As Recordset
    Dim db As DAO.Database
    Dim NumTrans As Integer
    Dim NumAudit As Integer
    Dim Count As Integer
    Dim STR As String
    
    
    Set db = CurrentDb
    
    STR = "SELECT distinct SysCordTrans.[USER ID] FROM SysCordTrans"
    Set AuditIDs = db.OpenRecordset(STR)

The error occurs on line:
Set AuditIDs = db.OpenRecordset(STR)

Thanks!
 
Two possibilities
1 - ensure the Microsoft 3.# Object Library is checked (in VBE - Tools | References)
2 - explicitly declare the recordset variable
[tt]dim AuditIDs as dao.recordset[/tt]

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top