2 replies
by john.a.wills
by talentonloan
I've run into a similar type of problem using older code samples or techniques in newer versions of Access.
The 'database' object is used in DAO (Data Access Objects) code which was standard in Access 97 I believe. Since ADO (Access Data objects) became the norm since Access 2000 and there are objects that use the same name (ie. recordset), the DAO is not by default installed. So you have to set a Reference to DAO in the application - in the VB Code side go to :
Tools - References - then check the Microsoft DAO 3.6 Object Library. Then Click OK. You should now have access to the 'Database' type of object.
Also, beware that if you declare certain types of objects as variables (ie. recordset) it will assume it is by default an ADO recordset. And when you try to run your code you will get an error. So for those object types where you are using DAO code which use names that are common to both ADO and DAO, define it as 'DAO.' ie.
Dim db as database
Dim rst as DAO.recordset
hope that makes sense
tol
This discussion is closed to new replies.
Trending Software posts
Sort by Trending