refer to recordset field using variable

Access 2003: Both libraries are preselected

Even though both libraries may be pre-selected one XOR the other will have the higher priority and I believe that to be DAO in A2K3.

But it still doesn’t matter because the code still works. We have all assumed, both you and I, that it has something to do with Tools/References but it doesn’t.

That’s the point I’m trying to get across…if we create variables of type Database and Recordset then we need correct references in Tools/References. But if we don’t create variables of type Database and Recordset then it defaults to DAO in all versions.

Now some people have known, for quite some time, that Form and Report class modules default to DAO. While that is correct it is also slightly misleading. Even in a standard module, when no Database and Recordset variables are declared, that procedure defaults to DAO in all versions.

And so another thing arises…like you I took it for granted that references need to be made, but they don’t. I too did not test it but simply read the documentation available and believed that that was the way to go.

I would suggest that people look again at what they have been doing for many years.

It may be partially right IOR it may be partially wrong but simply test it.

Regards,
Chris.
 
CurrentDB returns a database object. A database object exists only in DAO, not ADO.

So a recordset created by CurrentDb.OpenRecordset is always a DAO recordset.


The following is taken from Access's help file:
CurrentDb Method

The CurrentDb method returns an object variable of type Database that represents the database currently open in the Microsoft Access window.

Note In Microsoft Access 2000 the CurrentDb method establishes a hidden reference to the Microsoft DAO 3.6 Object Library in a Microsoft Access database (.mdb). ................... .......................
.
 
Last edited:
G’day Jon and thank you very much.

This the one of very few times that the A2K help file is better than the A97 help file and now I start to understand why.

The concept of a hidden reference does not appear in the A97 help file and probably because A97 did not need a hidden reference since it was DAO. But when A2K came along the default was ADO and to preserve CurrentDb integrity it still creates a DAO recordset.

And it seems that Microsoft have included that concept of a hidden reference in later versions and that’s why it works.

Makes sense to me and will continue to use it.

Thanks again and regards,
Chris.
 

Users who are viewing this thread

Back
Top Bottom