423,516 Members | 2,068 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 423,516 IT Pros & Developers. It's quick & easy.

ADO and DAO together in same application?

P: n/a
I'm sure I saw this somewhere, but I'm not finding it now. I'm using Access
XP. Some time ago I decided to go with DAO instead of ADO. Earlier today I
found a very cool article at The Access Web at
http://www.mvps.org/access/forms/frm0047.htm about having the background
color change for the current record. I don't know ADO but I know **some**
DAO. I suspect the code on that page is ADO, though it looks a little like
DAO. I incorporated the code from that page exactly per the instructions
and changed the KeyName and KeyValue to reflect the name of my primary key.
I'm getting the error saying, "Member or data member not found."

So I changed "Dim RS As Recordset" to "Dim RS As DAO.Recordset" and that got
the first record to highlight somewhat correctly but then the rest of the
records didn't work. Maybe it is DAO because when I changed it to "Dim RS
As ADODB.Recordset" I got the original error ("Member or data member not
found.") I'm wondering if maybe I disabled ADO at some point. I had to go
into references to reinable DAO in the first place. Maybe I also disabled
ADODB.

What do I need to enable in the references to run both DAO and ADO in the
same form? Is it even possible? I currently run my own DAO code
successfully but I have never successfully attempted ADO. If this has
already been covered (I suspect it probably has) could somebody point me to
the place where I could learn about running them both and what references I
will need? Also, if this page does describe DAO code rather than ADO, I
have something else wrong.

Thank you so much.

Rich Hollenbeck

Thanks.
Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
There's really nothing special you need to do to use ADO and DAO together,
other than disambigulating references for objects that exist in both models.
(The list of objects with the same names in the 2 models is Connection,
Error, Errors, Field, Fields, Parameter, Parameters, Property, Properties
and Recordset).

Having said that, the code in that example is strictly DAO (it's Access 97,
and no reference has been set to ADO)

Maybe if you went into a little more details about what "highlight somewhat
correctly but then the rest of the
records didn't work" means, we might be able to help you.

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

"Richard Hollenbeck" <ri****************@verizon.net> wrote in message
news:vZmNd.18583$uc.3707@trnddc03...
I'm sure I saw this somewhere, but I'm not finding it now. I'm using
Access
XP. Some time ago I decided to go with DAO instead of ADO. Earlier today
I
found a very cool article at The Access Web at
http://www.mvps.org/access/forms/frm0047.htm about having the background
color change for the current record. I don't know ADO but I know **some**
DAO. I suspect the code on that page is ADO, though it looks a little
like
DAO. I incorporated the code from that page exactly per the instructions
and changed the KeyName and KeyValue to reflect the name of my primary
key.
I'm getting the error saying, "Member or data member not found."

So I changed "Dim RS As Recordset" to "Dim RS As DAO.Recordset" and that
got
the first record to highlight somewhat correctly but then the rest of the
records didn't work. Maybe it is DAO because when I changed it to "Dim RS
As ADODB.Recordset" I got the original error ("Member or data member not
found.") I'm wondering if maybe I disabled ADO at some point. I had to
go
into references to reinable DAO in the first place. Maybe I also disabled
ADODB.

What do I need to enable in the references to run both DAO and ADO in the
same form? Is it even possible? I currently run my own DAO code
successfully but I have never successfully attempted ADO. If this has
already been covered (I suspect it probably has) could somebody point me
to
the place where I could learn about running them both and what references
I
will need? Also, if this page does describe DAO code rather than ADO, I
have something else wrong.

Thank you so much.

Rich Hollenbeck

Thanks.

Nov 13 '05 #2

P: n/a
On Sun, 06 Feb 2005 11:13:31 GMT, Richard Hollenbeck
<ri****************@verizon.net> wrote:
So I changed "Dim RS As Recordset" to "Dim RS As DAO.Recordset" and that
got
the first record to highlight somewhat correctly but then the rest of the
records didn't work. Maybe it is DAO because when I changed it to "Dim
RS
As ADODB.Recordset" I got the original error ("Member or data member not
found.")


In addition to what Douglas Steele said, note that:

1. While you can use both ADO and DAO easily together, you cannot just
willy-nilly mix objects - an ADO recordset is and always will be an ADO
recordset. It is a created object.

2. The FindFirst method should be a dead giveaway. ADO has no FindFirst.
Darryl Kerkeslager
Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.