DAO or ADO in Windows 2000, which to choose?

MS WORD

    Next

  • 1. Routing a Word Document -- please help!
    Please help, I need to send a Word document to various individuals to approve. I need to be able to print each approval when completed to serve as a back-up to my document Do you know if Word can perform these functions? I am thinking that I would use the "routing a document" to get the document to/from each individual but I am unsure how to print the approvals. Thanks!
  • 2. Problems with tab in forms...
    This is a complicated question. I'm trying to create a form which will use outline bullets, but there is a big problem... when the form is protected the tab key doesn't indent (which changes the level of the outline bullet), but instead goes to the next field, and the indent button is disabled when the form is locked... How do I make it so the tab key indents and assign the enter key to cycle to the next field Any help would be greatly appreciated.
  • 3. Hyperlink that runs a macro
    I have an index page on web with hyperlinks to Word files which works fine as a rule. But some of the documents have document_open code that needs to run, but does not when the document is opened from a hyperlink. Is there a way to get around this? Can anything be added to force a macro to run when a hyperlink is used? Thanks
  • 4. Hmm
    That is interesting. I'll mess with this general idea and see if I can figure out what it's prob is. If I do, I'll post the code. It should work just the same even tho I am in VB and your code is for VBA. The methods, etc are all the same. Got to love it.
  • 5. Error Handling overview
    Howdy All, This has to be a perennial favorite; is there a good overview of "best practices" for error handling in VB or VBA? I've read a couple "white papers" on the internet, but in general these seem to be advertisements for the features of proprietary error handlers. (Not that there is a problem with proprietary handlers per se, but I would prefer a less biased source of information). Also, I've downloaded the freeware code for HuntErr (from Urfin Jus), which is at least much more sophisticated than my own efforts. But it would be great to see what others have adopted as standard practice.

DAO or ADO in Windows 2000, which to choose?

Postby Simon Harvey » Mon, 04 Aug 2003 01:50:20 GMT

Hi guys,

I noticed when I tried to create a Database object in VBA, that VB had no
idea what i was talking about. I figured it would be another reference issue
but i couldnt think why such a default library would be missing. So I
discovered that ADO, which doesnt have a database object, is referenced by
default and you have to explicitly reference DAO 3.6 to get access to the
required objects.

I have two questions. How come ADO is used now instead of DAO and should I
be using ADO instead?

Also, in as few words as possible (i'm not expecting a whole article on it
:-), how do you access database tables using ADO.

Does anyone have a decent resource that describes ADO in terms of VBA
explicitly?

Thanks everyone

Kindest Regards

Simon



Re: DAO or ADO in Windows 2000, which to choose?

Postby Lars-Eric Gissl » Mon, 04 Aug 2003 04:43:14 GMT

Simon,

I'm not going to tell which one to use, but I only use ADO in VBA. Ok, I
nerly only works with MS SQLServer so then there is no problem. As I'm a
system developer I prefer ADO because you can use it in almost any
programming language as it's an ActiveX Interface to the OleDB system. That
makes life much easier :)

To put it simple, ODBC is the past and OleDB is the future. Even if your DB
vendor does only provides ODBC drivers (instead of OleDB provider) you can
still access ODBC drivers as there comes an OleDB provider also for ODBC.

There is nothing specific for VBA and ADO as the ActiveX interface is just
the same independent of which dev tool you are using, it's more a matter of
learning ADO's object model and how to use it. If you for instance know how
to use ADO in C++ you will also know how to use ADO in VBA. The syntax will
differ a little bit as they are two different dev tools but the way you use
the objects is still the same.

There are plenty of information on the MSDN site about how to use ADO. What
you should pay much attention to is the Connection object. The Command and
Recordset objects are quite straight forward. If your data source support
cursors you should learn as much as possible about cursors as you may get
unexpected behaviour is you use the wrong kind of kursor.

Regards,
Lars-Eric

"Simon Harvey" < XXXX@XXXXX.COM > skrev i


issue



Re: DAO or ADO in Windows 2000, which to choose?

Postby Phobos » Mon, 04 Aug 2003 06:10:32 GMT




issue


It's not missing, you just have to set a reference to it.

If VBA had native support for every concievable object library, the
resources required would be ridiculous, so you have to reference them.




Correct, Microsoft have decided that ADO is the way to go, even though most
Access programmers have a different opinion.




Depends, if you are using Access alone then DAO is quicker then ADO because
it manipulates JET dbs directly.




With the objects contained within ADO.




MSDN

P



Re: DAO or ADO in Windows 2000, which to choose?

Postby Phobos » Wed, 06 Aug 2003 03:50:03 GMT





Then they are Connection objects.


ADO is not "more powerful" than DAO, DAO is limited to manipulating JET
objects whereas ADO can access many different data-sources but is slower as
there is an extra layer (OLE DB).


DAO is much faster than ADO for manipulating Access data objects and there
is no real difference between the functionality of the two technologies,
most Access programmers use DAO whenever they can.

can't

Yes you can!

There is nothing to stop you declaring an ADO recordset and a DAO recordset
within the same procedure.

P



Re: DAO or ADO in Windows 2000, which to choose?

Postby martinique » Wed, 06 Aug 2003 06:22:38 GMT

Rather childishly pedantic set of responses ...











Yes, connections to databases.


as


ADO has a lot of features that DAO doesn't have (disconnected recordsets,
server/client-side cursors, schema-manipulation, shaped recordsets, etc,)
that make it significantly more powerful; and for most uses apps developed
with it run significantly faster also, even with plain JET tables.


Wrong all round. DAO can't manipulate Access data objects at all. You have
to use OLE automation for that. DAO can manipulate JET database objects
(such as are created by Access), but the speed difference is rarely
significant. 'No real difference between the functionalities' !? Suggest you
read the documentation before making a fool of yourself in public.

'Most' Access programmers? I doubt it, patently untrue, and irrelevant
anyway.

recordset

Apart from common sense. You can't exchange information between the two
other than manually via code.


Phobos, I regret the passing of DAO too. But that's no reason to be idiotic,
offensive, and untruthful in a posting. Get a life.






Re: DAO or ADO in Windows 2000, which to choose?

Postby Doug Robbins - Word MVP » Wed, 06 Aug 2003 13:50:45 GMT

I saw nothing offensive at all in Phobos response.

If you would post with a valid email address, I would make a few other
comments to you privately.

Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested.  Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP




idiotic,



Re: DAO or ADO in Windows 2000, which to choose?

Postby Phobos » Thu, 07 Aug 2003 02:51:52 GMT





What? Mine or yours?










So, what you are saying is that ADO can only connect to databases?


ADO has these features because you can connect to more and different apps
than just Access databases.

are
there

So DAO cannot manipulate data objects within Access???

I really do not know how to respond to that comment, it is so patently
absurd as to be nothing more than argument for the sake of argument.


You just stated that it can't, I wish you'd make your mind up.

you

I'm not in public.


Read the Access newsgroups.


So you can use both!

Why do you say "you can't use both" and then follow it up with a statement
that is supposed to reinforce your argument, but instead refutes it?


idiotic,

Do you listen to your own advice?

P



Similar Threads:

1.DAO or ADO in Windows 2000, which to choose?

Hi guys,

I noticed when I tried to create a Database object in VBA, that VB had no
idea what i was talking about. I figured it would be another reference issue
but i couldnt think why such a default library would be missing. So I
discovered that ADO, which doesnt have a database object, is referenced by
default and you have to explicitly reference DAO 3.6 to get access to the
required objects.

I have two questions. How come ADO is used now instead of DAO and should I
be using ADO instead?

Also, in as few words as possible (i'm not expecting a whole article on it
:-), how do you access database tables using ADO.

Does anyone have a decent resource that describes ADO in terms of VBA
explicitly?

Thanks everyone

Kindest Regards

Simon


2.ADO versus DAO and Windows 2000

A few weeks ago I was asking about the performance of ADO against an
Access 97 mdb, and later, taking advice, I implemented DAO to compare.

However, now I have had occasion to test my project on Windows 2000
and the performance is way, way better with ADO. Same VB6 program,
same CPU/Mobo, same query, same database. The only thing that is
different is that the W2K PC has 1gb of RAM whereas my standard Win
98SE PC has 512mb.

Is the performance increase due to W2K being a fundamentally different
OS, maybe using threads automatically, or other 'speed up' tricks?
Could the extra RAM make such a huge difference. I'm talking about 25
secs on the Win 98SE box and 3 secs on the W2K PC.

MM

3.ADO vs DAO How to get the dialog to add/select ODBC DSN Connect in

What is the equivalent ADO code to open the ODBC dialog which allows a user 
to  select or create and then select the DSN of an ODBC data source.

In earlier versions of Access, using DAO the following code is used.

public function fnGetODBCConnect () as string
   Dim wrkODBC As Workspace
   Dim conPubs As Connection

    Set wrkODBC = CreateWorkspace("NewODBCWorkspace", "admin", "", dbUseODBC)

Set conPubs = wrkODBC.OpenConnection("Connection", dbDriverPrompt, True, 
"ODBC;DSN=MyDSN;")

fnGetODBCConnect = conPubs.Connect
Exit Function

 Which would open up the ODBC dialog for creating/selecting a DSN and allow 
me to get the connect string to an ODBC data source.   

In all of the examples of ADO connections, all they show is keying in the 
connect string which is not what I need.    


-- 
Larry

4.DAO to ADO and Finding records

I have the following code that works fine in DAO but when change to ADO it 
fails and I've run out of ideas to try. And pointers please.

Private Sub FindCourse(varCourse As Variant)
    Dim LV As Variant
    
    Dim rec As DAO.Recordset ' I change this to ADODB.recordset
    
    Dim strBookmark As String
    LV = Trim(varCourse)
    If IsNull(varCourse) Then
        MsgBox "No Record Found", vbInformation, "Error!"
        Exit Sub
    End If
    'If Me.Dirty Then
     'Me.Dirty = False
     'End If
    
    Forms!CourseDetails.SetFocus
    DoCmd.GoToControl Forms!CourseDetails!Field94.Name
    
    Set rec = Forms!CourseDetails.RecordsetClone
    
    rec.FindFirst "[CourseCounter] = " & CLng(LV)  ' & """" 'CStr()

    If Not rec.NoMatch Then  ' Change to If rec.EOF Then

        strBookmark = rec.Bookmark
        Forms!CourseDetails.Bookmark = strBookmark
    End If

    DoCmd.GoToControl Forms!CourseDetails!Field94.Name
    DoCmd.Close A_FORM, "fdlgFind"
    rec.Close
  
End Sub

5.DAO or ADO

I use Word as the user interface for accessing, searching and updating 
databases. Up to now I've stored the data in Excel workbooks but the problems 
there are multiple access and some trouble getting Excel to quit properly 
(apparently a known 'bug').

First question: is mdb the best database format to use in this case ?

Second question: what method should I use for calling up the database from 
VBA ? The examples I've found here seem to tend towards DAO but I've found 
lots of references on the web to ADO being better, faster, easier to program 
etc. Since my experience with either is limited, I'm prepared for some long 
hours of studying but I want to know which to concentrate on for automation 
from Word.

Any advice, anecdotes, links that could help me make up my mind ?

-- 
David M
WinXP - Office2003 (Italian)

6. Problem with searh ADO in Active directory on Windows 2000 server

7. Problem with search ADO in Active directory on Windows 2000 server

8. ADO 2.8 on Windows Server 2000?



Return to MS WORD

 

Who is online

Users browsing this forum: No registered users and 73 guest