Microsoft DAO 3.51 Object library Error

G

Guest

I have been having a problem with MS Access over the last several days. One
of the associated dll files is not working properly. An error is encountered
with existing code. To correct the error I reselect the reference(dll) for
Microsoft DAO 3.51 Object library and the application began returning error
messages on code that was not modified. The problem first happened in an
Access 97 application. Then it occured in an Access 2000 application that
uses SQL Server tables. The problem presented itdself on three seperate
computers.

Here is the code I ran and the error I got.

Sub Report1(StartDate As Date, EndDate As Date)
Dim db As Database, rst As Recordset, SQL As String, SQL2 As String, I As
Integer
Dim Division As String, QDF As QueryDef, qn As String

Set db = CurrentDb

SQL = "SELECT Division.Description FROM Division;"
Set rst = db.OpenRecordset(SQL, dbOpenDynaset)

Returns - Error Number - 13
Error Description - Type mismatch

Any suggestions are most welcome.
BCP
 
D

Dirk Goldgar

BCP said:
I have been having a problem with MS Access over the last several
days. One of the associated dll files is not working properly. An
error is encountered with existing code. To correct the error I
reselect the reference(dll) for Microsoft DAO 3.51 Object library and
the application began returning error messages on code that was not
modified. The problem first happened in an Access 97 application.
Then it occured in an Access 2000 application that uses SQL Server
tables. The problem presented itdself on three seperate computers.

Here is the code I ran and the error I got.

Sub Report1(StartDate As Date, EndDate As Date)
Dim db As Database, rst As Recordset, SQL As String, SQL2 As String,
I As Integer
Dim Division As String, QDF As QueryDef, qn As String

Set db = CurrentDb

SQL = "SELECT Division.Description FROM Division;"
Set rst = db.OpenRecordset(SQL, dbOpenDynaset)

Returns - Error Number - 13
Error Description - Type mismatch

Any suggestions are most welcome.

First, if you're using Access 2000, you should be using DAO 3.6, not
3.51. Second, the type of error you're getting is seen most commonly
when the project also has a reference set to ADO (Microsoft ActiveX Data
Objects 2.x Library). In that case, it occurs because both the DAO and
ADO libraries define a Recordset object, and the two objects are not
compatible. We normally don't see this error in Access 97, because that
version doesn't include reference to ADO by default; however, Access
2000 does.

If this is the problem, and you're not using ADO in your database,
remove the reference to ADO, leaving just the reference to DAO. If you
*are* using both ADO and DAO, qualify all declarations of the following
object types with either "DAO." or "ADODB.", as appropriate:

Connection
Error
Errors
Field
Fields
Parameter
Parameters
Property
Properties
Recordset

It's most often the Recordset object that bites you, though.
 
G

Guest

Worked like a charm. Thank you for your help.

Dirk Goldgar said:
First, if you're using Access 2000, you should be using DAO 3.6, not
3.51. Second, the type of error you're getting is seen most commonly
when the project also has a reference set to ADO (Microsoft ActiveX Data
Objects 2.x Library). In that case, it occurs because both the DAO and
ADO libraries define a Recordset object, and the two objects are not
compatible. We normally don't see this error in Access 97, because that
version doesn't include reference to ADO by default; however, Access
2000 does.

If this is the problem, and you're not using ADO in your database,
remove the reference to ADO, leaving just the reference to DAO. If you
*are* using both ADO and DAO, qualify all declarations of the following
object types with either "DAO." or "ADODB.", as appropriate:

Connection
Error
Errors
Field
Fields
Parameter
Parameters
Property
Properties
Recordset

It's most often the Recordset object that bites you, though.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top