ADO Versus DAO

For several years, Microsoft recommended DAO (Data Access Objects) for accessing data in external database. With Excel 2000 and VB6, Microsoft still supports DAO, but recommends ADO (ActiveX Data Objects). The concepts are similar and the syntax is only slightly different. I am going to use the newer ADO in this chapter. Realize that if you start going through code written a while ago, you might run into DAO code. Other than a few syntax changes, the code for both ADO and DAO looks similar. The Microsoft Knowledge Base articles you can find at the following address discuss the differences: http://support.microsoft.com/default.aspx?scid=KB;EN-US;q225048&

The following two articles provide the Rosetta Stone between DAO and ADO. The ADO code is shown at http://support.microsoft.com/default.aspx?scid=KB;EN-US;q146607& and the equivalent DAO code is shown at http://support.microsoft.com/default.aspx?scid=KB;EN-US;q142938&

To use any code in this chapter, open the Visual Basic Editor. Select Tools, References from the main menu, and then select Microsoft ActiveX Data Objects 2.1 Library (or higher) from the available references list, as shown in Figure 19.1.

Figure 19.1

To read or write from an Access MDB file, add the reference for Microsoft ActiveX Data Objects 2.1 or higher.

Figure 19.1

To read or write from an Access MDB file, add the reference for Microsoft ActiveX Data Objects 2.1 or higher.

0 0

Post a comment