Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Setup / Configuration / May 2008

Tip: Looking for answers? Try searching our database.

DAO to ADO

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Luciano - 11 May 2008 19:51 GMT
I tried the new ADODB.Recordset of VBA in Access2007 to open tables, but
Access2007 don't understand this syntax. Maybe I have to Add a Reference?
Tony Toews [MVP] - 12 May 2008 01:58 GMT
>I tried the new ADODB.Recordset of VBA in Access2007 to open tables, but
>Access2007 don't understand this syntax. Maybe I have to Add a Reference?

Correct.  You need to add the ADO reference.

But if you're already using DAO why think about using ADO?

Tony
Signature

Tony Toews, Microsoft Access MVP
  Please respond only in the newsgroups so that others can
read the entire thread of messages.
  Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
  Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/

Luciano - 12 May 2008 07:57 GMT
because I have some problems to split my tables, I think DAO is the reason?

> >I tried the new ADODB.Recordset of VBA in Access2007 to open tables, but
> >Access2007 don't understand this syntax. Maybe I have to Add a Reference?
[quoted text clipped - 4 lines]
>
> Tony
Douglas J. Steele - 12 May 2008 22:13 GMT
Very doubtful.

DAO is the native approach for communicating with Access files, ADO isn't.

What's the problem you're having splitting your database?

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)

> because I have some problems to split my tables, I think DAO is the
> reason?
[quoted text clipped - 8 lines]
>>
>> Tony
Luciano - 13 May 2008 19:45 GMT
I wrote in the past some sub-routine (inDAO) in a Global Module something like:

Option Compare Database
Option Explicit
Public ws As Workspace
Public db As Database
Public tbInitialisatie As Recordset

Public Sub OpenInitialisatie()
On Error GoTo ErrorOpenInitialisatie
Set ws = DBEngine.Workspaces(0)
Set db = DBEngine.Workspaces(0).Databases(0)
Set tbInitialisatie = db.OpenRecordset("tblInitialisatie", DB_OPEN_TABLE)
MsgBox “DAO OK”
ExitError:
Exit Sub
ErrorOpenInitialisatie:
MsgBox "ErrorOpenInitialisatie DAO"
Resume ExitError
End Sub

Whan I split my tables, and I call this routine in a form, I get the message
"ErrorOpenInitialisatie DAO"

Yesterday I wrote the code (in ADO):

Option Compare Database
Option Explicit
Public tbInitialisatie As New ADODB.Recordset

Public Sub OpenInitialisatie()
tbInitialisatie.Open "tblInitialisatie", CurrentProject.Connection,
adOpenKeyset, adLockOptimistic
MsgBox “ADO OK”
ExitError:
Exit Sub
ErrorOpenInitialisatie:
MsgBox "ErrorOpenInitialisatie ADO"
Resume ExitError
End Sub

and I don't get the Erro-message anymore, but I get the 'good' message “ADO
OK”

> Very doubtful.
>
[quoted text clipped - 14 lines]
> >>
> >> Tony
Douglas J. Steele - 14 May 2008 02:12 GMT
If you have references set for both ADO and DAO, you'll find that you'll
need to "disambiguate" certain declarations, because objects with the same
names exist in the 2 models.

Try using

Public tbInitialisatie As DAO.Recordset

The list of objects with the same names in the 2 models is Connection,
Error, Errors, Field, Fields, Parameter, Parameters, Property, Properties
and Recordset

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)

>I wrote in the past some sub-routine (inDAO) in a Global Module something
>like:
[quoted text clipped - 63 lines]
>> >>
>> >> Tony
Luciano - 14 May 2008 09:43 GMT
In my first sub-routine, I did not set references for ADO, and yet I have the
Error-message.
In my splitted database (see my second sub-routine that replaces my first
sub-routine), I did set the ADO reference and then I don't have the
Error-message.
This means (I think) that there are no same names in my declarations.
In my case, I can only split my tables  in ADO-mode and not in DAO-mode.

> If you have references set for both ADO and DAO, you'll find that you'll
> need to "disambiguate" certain declarations, because objects with the same
[quoted text clipped - 75 lines]
> >> >>
> >> >> Tony
Brendan Reynolds - 15 May 2008 12:13 GMT
The problem may be that your DAO code is attempting to open a table-type
recordset, and you can't do that with linked tables. Try dbOpenDynaset
instead of DB_OPEN_TABLE.

Signature

Brendan Reynolds

> In my first sub-routine, I did not set references for ADO, and yet I have
> the
[quoted text clipped - 88 lines]
>> >> >>
>> >> >> Tony
AccessVandal - 22 May 2008 02:47 GMT
As Douglas said, you need to both references.

Access by default is ADO (A2K and A2003 I believe.) You didn't say what
version or the SP.

To use DAO, you need to use the references like...

Public ws As DAO.Workspace
Public db As DAO.Database
Public tbInitialisatie As DAO.Recordset

>In my first sub-routine, I did not set references for ADO, and yet I have the
>Error-message.
[quoted text clipped - 6 lines]
>> If you have references set for both ADO and DAO, you'll find that you'll
>> need to "disambiguate" certain declarations, because objects with the same

Signature

Please Rate the posting if helps you

aaron.kempf@gmail.com - 15 May 2008 02:46 GMT
I'm not so sure that I agree with that.

DAO might be the _OLD_ way to communicate with _JET_ files.
But 'Access Files' do not explicitly refer to MDB.  MDB is the
deprecrated format; it has not had any improvements since 1995.

DAO is too buggy for real world usage-- move to ADO.

-Aaron

On May 12, 2:13 pm, "Douglas J. Steele"
<NOSPAM_djsteele@NOSPAM_canada.com> wrote:
> Very doubtful.
>
[quoted text clipped - 29 lines]
>
> - Show quoted text -
Tony Toews [MVP] - 21 May 2008 05:20 GMT
>DAO might be the _OLD_ way to communicate with _JET_ files.
>But 'Access Files' do not explicitly refer to MDB.  MDB is the
>deprecrated format; it has not had any improvements since 1995.
>
>DAO is too buggy for real world usage-- move to ADO.

Aaron is completely wrong.

Tony
Signature

Tony Toews, Microsoft Access MVP
  Please respond only in the newsgroups so that others can
read the entire thread of messages.
  Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
  Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/

David W. Fenton - 23 May 2008 22:39 GMT
"aaron.kempf@gmail.com" <aaron.kempf@gmail.com> wrote in
news:f0ea1557-7ce1-40ef-b364-9a7ee5d5b278@l17g2000pri.googlegroups.co
m:

> DAO might be the _OLD_ way to communicate with _JET_ files.
> But 'Access Files' do not explicitly refer to MDB.

What, then, would they refer to? ACCDB? If so, then, yes, DAO is the
preferred interface, and it's the new update of DAO that shipped
with A2K7. DAO is alive and well, and is still the preferred
interface for all Jet data (ACCDB is still Jet data).

I don't understand your insistence on posting such obviously
erroneous information. Do you place no value whatsoever on your
credibility?

Or are you just batshit crazy?

Signature

David W. Fenton                  http://www.dfenton.com/
usenet at dfenton dot com    http://www.dfenton.com/DFA/


Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.