Welcome to dbFreaks.com!
FAQFAQ   SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

DAO reference / Access 2007

 
   Database Help (Home) -> Visual Basic -> DAO RSS
Related Topics:
problem setting "RecordSource" in Office Access 2007 ... - I have a form in Office Access 2007, the property of which I;m trying to set. But first, I some have a push button control at the top of each column in my form that, when pressed, is supposed to change the sort order..

Error after converting from Access 97 to Access 2002-2003 .. - Hello, I convert my Access 97 Database to Access because I’m now using WinXP. And now when I run my VB program, I get Runtime error '3343' - database format. I'm using Do I have to change to another DLL? Thanks. ..

VB6 Access 2000 : Error 3085 undefined function, works wh.. - I've been using VB6 with DAO 3.6 and an Access 2000 format database fine for a few years. I recently added a module function that one of the Access queries uses. It is only called from with the Access query. When I try to set the first parameter from..

Can't access newsgroup using NNTP Newsreader - Hi. I've been unable to access the newsgroup using NNTP However, I can access it through the browser. The message that appeared is : The newsgroup was not

Problem with DAO (Import from Excel to Access)! :( - Hi, I am novice and I have problem. I need import some data with Excel file to Access. Problem as follows: In sheet) i have data: - column - column - column - column Excel file..
Next:  Jet error  
Author Message
Dustin Pedroia

External


Since: Feb 27, 2008
Posts: 1



(Msg. 1) Posted: Wed Feb 27, 2008 1:42 pm
Post subject: DAO reference / Access 2007
Archived from groups: microsoft>public>vb>database>dao (more info?)

while using an Access 2007 .accdb file I can access the dao. object very
easily.
the following code in VBA works well :
Function getrecordcount(strTableName As String) As Long
Dim dbCurrent As DAO.Database
Set db = CurrentDb
Dim rstRecords As DAO.Recordset
Dim rstRecords2 As DAO.Recordset2
Set rstRecords = db.OpenRecordset(strTableName, dbOpenForwardOnly)

all the DAO.xxx references are recognized and are generated from the
Microsoft Office 12.0 Access database engine Object Library, acedao.dll
as evidenced by the ability to reference Recordset2.

but when similar code is generated in Visual Basic 2005 I am unable to
access the dao. object library using the same dao. naming conventions. for
some reason it forces me to use Microsoft.Office.Interop.Access.Dao.xxx in
every statement instead of just dao.

similar code in Visual Basic 2005 is :
Function getrecordcount(ByVal strTableName As String) As Long
Dim dbEngine As Microsoft.Office.Interop.Access.Dao.DBEngine
Dim db As Microsoft.Office.Interop.Access.Dao.Database
dbEngine = New Microsoft.Office.Interop.Access.Dao.DBEngine()
db = dbEngine.OpenDatabase("filename.accdb")
Dim rstRecords As Microsoft.Office.Interop.Access.Dao.Recordset
Dim rstRecords2 As Microsoft.Office.Interop.Access.Dao.Recordset2
rstRecords = db.OpenRecordset("strTableName", dbOpenForwardOnly)
rstRecords2 = db.OpenRecordset("strTableName", dbOpenForwardOnly)

and dbOpenForwardOnly generates a compile error of "is not declared"
while
Microsoft.Office.Interop.Access.Dao.RecordsetTypeEnum.dbOpenForwardOnly works
perfectly.

any ideas why dao. naming convention don't work ?
and why constants like dbOpenForwardOnly don't work ?
and why long naming like
Microsoft.Office.Interop.Access.Dao.RecordsetTypeEnum.dbOpenForwardOnly
is required ?

thanks

I do have the Microsoft Office 12.0 Access database engine Object Libary
added in Visual Basic 2005.
in VBA this object libary is located as c:\Program Files\Common
Files\Microsoft Shared\Acedao.dll
in VB 2005 it has a path of
c:\windows\assembly\GAC\Microsoft.Office.Interop.Access.Dao\12.0.0.__71e9bce111e9429c\Microsoft.Office.Interop.Access.Dao.dll

 >> Stay informed about: DAO reference / Access 2007 
Back to top
Login to vote
Ralph

External


Since: Jan 28, 2008
Posts: 31



(Msg. 2) Posted: Wed Feb 27, 2008 6:24 pm
Post subject: Re: DAO reference / Access 2007 [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"Dustin Pedroia" <DustinPedroia.RemoveThis@discussions.microsoft.com> wrote in message
news:A43329EF-4DFD-43CE-B81F-05B2C9354B9C@microsoft.com...
> while using an Access 2007 .accdb file I can access the dao. object very
> easily.
> the following code in VBA works well :
> Function getrecordcount(strTableName As String) As Long
> Dim dbCurrent As DAO.Database
> Set db = CurrentDb
> Dim rstRecords As DAO.Recordset
> Dim rstRecords2 As DAO.Recordset2
> Set rstRecords = db.OpenRecordset(strTableName, dbOpenForwardOnly)
>
> all the DAO.xxx references are recognized and are generated from the
> Microsoft Office 12.0 Access database engine Object Library, acedao.dll
> as evidenced by the ability to reference Recordset2.
>

Yep. That's because MSAccess is doing magic behind your back. When using an
ACCDB file within Access VBA - VBA "DAO" to the ACEDAO library (ACEDAO.DLL).

Now if you opened a MDB file in Access VBA, VBA would see it as the original
DAO library (DAO360.DLL).

Magic. <g>


> but when similar code is generated in Visual Basic 2005 I am unable to
> access the dao. object library using the same dao. naming conventions.
for
> some reason it forces me to use Microsoft.Office.Interop.Access.Dao.xxx in
> every statement instead of just dao.
>

This is because from a managed enviroment you have to use Interop or "COM".
Frankly I haven't played MS 2007 so I'm not sure what happens - I think it
would have to map to acedao, but ???? I don't know for sure.

So far it has been my experience that using Interop is often different than
using the COM components directly. Simply because you are dealing with a
Fascade or Bridge - or perhaps more loosely put - a Wrapper. ie, someone had
to set down and write it and it is not a one-to-one straight conversion.

However, for better information you should post to a dotNet newsgroup, or
perhaps to an MSAccess developers group.

hth
-ralph

 >> Stay informed about: DAO reference / Access 2007 
Back to top
Login to vote
Display posts from previous:   
   Database Help (Home) -> Visual Basic -> DAO All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]