Worked fine yesterday, today I get Error 13 Type Mismatch errors 
Author Message
 Worked fine yesterday, today I get Error 13 Type Mismatch errors

Hi all,
I have some very simple DAO code that creates a temporary
querydef, executes it into a recordset, and then does
stuff with the results. (snippet here...)

    Dim myDB As Database
    Dim myQD As QueryDef
    Dim myRS As Recordset

    Set myDB = CurrentDb

    With myDB
        ' Create temporary QueryDef.
        Set myQD = .CreateQueryDef("", _
            "SELECT desc FROM valveloc where id = " & _
            loc_id)

-->     Set myRS = myQD.OpenRecordset(dbOpenSnapshot)

        myRS.MoveFirst
        GetValveDesc = myRS!desc
        myRS.Close

It ran fine a few days ago, now it consistantly dies at
the line with the error with a Error 13 - Type Mistmatch.
The SQL it's trying to exe is "SELECT desc FROM valveloc
where id = 1".  This is under Office XP, all in Access,
Oracle backend via ODBC. DAO 3.6 selected (although) 3.51
did the same.

Any advice on what's causing this and how to get rid of it?

Any and all help appreciated.
-Bill



Mon, 25 Jul 2005 12:56:40 GMT  
 Worked fine yesterday, today I get Error 13 Type Mismatch errors
From Office 2K on, try using following
change in dao declarations.

Replace

Quote:
>     Dim myDB As Database
>     Dim myQD As QueryDef
>     Dim myRS As Recordset

by:
    Dim myDB As DAO.Database
    Dim myQD As DAO.QueryDef
    Dim myRS As DAO.Recordset

Krgrds,
Perry



Quote:
> Hi all,
> I have some very simple DAO code that creates a temporary
> querydef, executes it into a recordset, and then does
> stuff with the results. (snippet here...)

>     Dim myDB As Database
>     Dim myQD As QueryDef
>     Dim myRS As Recordset

>     Set myDB = CurrentDb

>     With myDB
>         ' Create temporary QueryDef.
>         Set myQD = .CreateQueryDef("", _
>             "SELECT desc FROM valveloc where id = " & _
>             loc_id)

> -->     Set myRS = myQD.OpenRecordset(dbOpenSnapshot)

>         myRS.MoveFirst
>         GetValveDesc = myRS!desc
>         myRS.Close

> It ran fine a few days ago, now it consistantly dies at
> the line with the error with a Error 13 - Type Mistmatch.
> The SQL it's trying to exe is "SELECT desc FROM valveloc
> where id = 1".  This is under Office XP, all in Access,
> Oracle backend via ODBC. DAO 3.6 selected (although) 3.51
> did the same.

> Any advice on what's causing this and how to get rid of it?

> Any and all help appreciated.
> -Bill



Mon, 25 Jul 2005 20:20:28 GMT  
 Worked fine yesterday, today I get Error 13 Type Mismatch errors
Perry,
That worked great. I'm guessing that that explicitly
creates those variables as DAO variables so
the 'References...' list order ceases to matter. I guess
they were getting created as ADO variables and thus
the 'type mismatch'es.
Thanks again for the help!
-Bill
Quote:
>-----Original Message-----
>From Office 2K on, try using following
>change in dao declarations.

>Replace
>>     Dim myDB As Database
>>     Dim myQD As QueryDef
>>     Dim myRS As Recordset
>by:
>    Dim myDB As DAO.Database
>    Dim myQD As DAO.QueryDef
>    Dim myRS As DAO.Recordset

>Krgrds,
>Perry



Tue, 26 Jul 2005 02:36:25 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Error 13: Type Mismatch error

2. Type Mismatch Run-Time error 13

3. Type Mismatch Error 13

4. type mismatch error '13'????

5. Using CurrentDB() receives Type Mismatch Error 13

6. Type mismatch, run-time error #13

7. type 13 mismatch error

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

9. Invalid Reference (Error 13 - Type Mismatch)

10. Run -time error '13' Type Mismatch

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

 

 
Powered by phpBB® Forum Software