Type mismatch, run-time error #13 
Author Message
 Type mismatch, run-time error #13

Why do I get a type mismatch with this set of code????

    Dim dbsSPAM As Database
    Dim rstAuditTrail As Recordset
    Dim strTable As String

    Set dbsSPAM = CurrentDb
    strTable = "Audit Trail Table"
    Set rstAuditTrail = dbsSPAM.OpenRecordset(strTable, dbOpenTable)

Vic



Sat, 29 Nov 2003 22:51:02 GMT  
 Type mismatch, run-time error #13

Quote:

>Why do I get a type mismatch with this set of code????

>    Dim dbsSPAM As Database
>    Dim rstAuditTrail As Recordset
>    Dim strTable As String

>    Set dbsSPAM = CurrentDb
>    strTable = "Audit Trail Table"
>    Set rstAuditTrail = dbsSPAM.OpenRecordset(strTable, dbOpenTable)

>Vic

Vic

If you mean that you are getting an error on the line 'Set rsAuditTrail=...'
and are using A2K, then this is because although you have a reference to DAO in
your database, you still have a reference to ADO. Unfortunately, both of these
Object Libraries have a Recordset object, with different properties, and as you
have not told Access which one it is, it is assuming that it is the higher one
in the list of references, ie ADO.

To fix, either remove the reference to ADO if you are not going to use ADO (why
keep something that you're not going to use), or else explicitly declare
objects where appropriate:

Dim rsADO As ADODB.Recordset
Dim rsDAO As DAO.Recordset

Jon

Access tips & tricks - http://www.applecore99.com
Microsoft Access webring -
http://nav.webring.yahoo.com/hub?ring=microsoftaccess



Sun, 30 Nov 2003 01:14:39 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Type Mismatch Run-Time error 13

2. Mdac2.6 to Mdac2.7 causes Type Mismatch Runtime Error 13

3. ACC2000:Run Time Error '13': Type Mismatch

4. Run -time error '13' Type Mismatch

5. Run-time error '13': Type mismatch

6. Run-time error '13': Type mismatch

7. Run-time error '13': Type mismatch

8. Run Time Error 13 Type Mismatch

9. run time error 13, data type mismatch !

10. "Run-time error 13: Type Mismatch"

11. Run Time Error "13" Type Mismatch

12. Type Mismatch - Run Time Err 13

 

 
Powered by phpBB® Forum Software