Type mismatch and reference

B

Brian

I just updated a DB from Access 2000 to 2003. It was a very basic conversion
and took two minutes, but afterward I got a type mismatch on the last line
below:

Dim strSQL as String
Dim rsInvoice As Recordset
strSQL = "SELECT InvoiceNumber from PetroInvoice WHERE Status = 'Ready'"
Set rsInvoice = CurrentDb.OpenRecordset(strSQL, dbOpenSnapshot)

I got it to work by explicitly dimensioning the Recordset as DAO.Recordset,
so I tried removing/adding the DAO 3.6 Objects reference, to no avail.

After a little more tinkering, I finally removed the reference to MS ActiveX
Objects 2.1 Library and replaced it with 2.5.

Why does the Recordset reference rely on the ActiveX library? Shouldn't that
object be in the DAO objects library?
 
G

Graham Mandeno

Hi Brian

Recordset is one of a number of objects (Field is another) that are defined
in both the ADO and the DAO libraries. If you don't qualify the declaration
(DAO.Recordset or ADODB.Recordset) then the one that will be used is the
first in the reference list. I suspect that when you removed ADO 2.1 and
added ADO 2.5, you moved it from above DAO to below it in the references
list.

If you are not using ADO at all in your code (for a pure Access/Jet
application it is rarely necessary) then you can completely remove the ADO
reference.
 
B

Brian

Thank you, Graham.

I learn something new every day - mostly here, after beating my head against
the wall trying to figure it out on my own first.

Graham Mandeno said:
Hi Brian

Recordset is one of a number of objects (Field is another) that are defined
in both the ADO and the DAO libraries. If you don't qualify the declaration
(DAO.Recordset or ADODB.Recordset) then the one that will be used is the
first in the reference list. I suspect that when you removed ADO 2.1 and
added ADO 2.5, you moved it from above DAO to below it in the references
list.

If you are not using ADO at all in your code (for a pure Access/Jet
application it is rarely necessary) then you can completely remove the ADO
reference.
--
Good Luck :)

Graham Mandeno [Access MVP]
Auckland, New Zealand

Brian said:
I just updated a DB from Access 2000 to 2003. It was a very basic
conversion
and took two minutes, but afterward I got a type mismatch on the last line
below:

Dim strSQL as String
Dim rsInvoice As Recordset
strSQL = "SELECT InvoiceNumber from PetroInvoice WHERE Status = 'Ready'"
Set rsInvoice = CurrentDb.OpenRecordset(strSQL, dbOpenSnapshot)

I got it to work by explicitly dimensioning the Recordset as
DAO.Recordset,
so I tried removing/adding the DAO 3.6 Objects reference, to no avail.

After a little more tinkering, I finally removed the reference to MS
ActiveX
Objects 2.1 Library and replaced it with 2.5.

Why does the Recordset reference rely on the ActiveX library? Shouldn't
that
object be in the DAO objects library?
 

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

Top