[AccessD] A2K: OpenRecordset doesn't

Jim Lawrence (AccessD) accessd at shaw.ca
Sat Apr 12 13:52:36 CDT 2003


Hi Darren:

>"Run time error 13 'Type Mismatch"

It is stating that one the variables in this equation is not set to 'right
object type'. It is most likely the 'rst' variable that is not defined as an
ADO recordset object (Dim rst as ADODB.Recordset), or that the Reference to
the ActiveX ADO library was not setup yet.

HTH
Jim

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Darren DICK
Sent: Saturday, April 12, 2003 7:33 AM
To: AccessD List
Subject: [AccessD] A2K: OpenRecordset doesn't


Hello all
Can anyone shed some light on why my code fails on
the line...
 Set rst = dbs.OpenRecordset("SELECT * FROM
tblMyTable;", dbOpenDynaset)
and I get the error "Run time error 13 'Type
Mismatch"

Many thanks
Darren

________________________________
Public Sub MySub()
Dim dbs As Database
Dim rst As Recordset

    Set dbs = CurrentDb
    '<Fails on the line below>
    Set rst = dbs.OpenRecordset("SELECT * FROM
tblMyTable;", dbOpenDynaset)
    '<Fails on the line above>

    With rst
        .MoveLast
        Debug.Print .RecordCount
        .Close
    End With

    Set dbs = Nothing

End Sub


________________________________

_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list