[AccessD] Question on Reference (DAO)

Tom Bolton tom.bolton at donnslaw.co.uk
Fri Feb 11 07:18:39 CST 2005


Not necessarily.

You can't just replace DAO objects with ADO ones, as they have different
properties and methods and some just plain don't exist - e.g. there is no
ADODB.Database.  Quick example to open an ADO recordset from an Access
table:

' -----------------
' START CODE EXAMPLE
Dim conn as ADODB.Connection
Dim rs As New ADODB.Recordset
Dim strSQL As String

' grabs local Access database, similar to DAO.Database
Set conn = CurrentProject.Connection 

strSQL = "SELECT etc..."
rs.Open conn, strSQL, adOpenKeyset, adLockPessimistic
' -----------------
' END CODE EXAMPLE


When you set your references in your project (Tools > References), take a
look to see where the project is picking up the DLL's, TLB's etc. from.  For
example, the ADO files will come from c:\program files\common
files\system\ado more often than not.  Now bear in mind that your
application, when deployed, will go looking for these files in the same
place on the client machine.  IF they are not there you will get a fatal
error and your VBA will halt in its tracks.

HTT
Cheers
Tom




-----Original Message-----
From: John Clark [mailto:John.Clark at niagaracounty.com] 
Sent: 11 February 2005 13:03
To: accessd at databaseadvisors.com
Subject: RE: [AccessD] Question on Reference (DAO)

So, where I already had:

Dim db As DAO.Database
Dim rs As DAO.Recordset

I would put:

Dim db As ADODB.Database
Dim rs As ADODB.Recordset

?????

It is working now, because I went into Tools/References and clicked on
the, "Microsoft DAO 3.6 Reference Library." I was just wondering if this
would follow through to the client PC.


-------------- next part --------------

The contents of this message and any attachments are the property of Donns Solicitors 
and are intended for the confidential use of the named recipient only.  They may be legally
 privileged and should not be communicated to, or relied upon, by any other party without 
our written consent.  If you are not the addressee, please notify us immediately so that we 
can make arrangements for its return.  You should not show this e-mail to any person or
 take copies as you may be committing a criminal or civil offence for which you may be
 liable.  The statement and opinions expressed in this e-mail message are those of the 
writer, and do not necessarily represent that of Donns Solicitors.  Although any files attached
 to this e-mail will have been checked with virus protection software prior to transmission, 
you should carry out your own virus check before opening any attachment.  
Donns Solicitors does not accept any liability for any damage or loss which may be caused 
by software viruses...


More information about the AccessD mailing list