Friday 22 June 2012

1. DAO & ADO in VBA


1. DAO verses ADO

The DAO and ADO libraries both have a Recordsetobject, but with different methods, properties, and options.
DAO is the native Access library (what Access itself uses), whereas ADO is a more generic library (now superseded by the vastly different ADO.NET library.)

Different versions of Access default to different libraries. See Solving Problems with Library Referencesfor details.

This article assumes DAO recordsets.

Solution:

To ensure your code works reliably:
  1. Set your references to use just the library you want.
  2. If you must use both, list your main one first.
  3. Disambiguate by specifying which library's recordset you want. Use:
        Dim rs As DAO.Recordset
    not:
        Dim rs As Recordset


No comments:

Post a Comment