Skip to content

Latest commit

 

History

History
129 lines (106 loc) · 2.6 KB

converting-dao-code-to-ado.md

File metadata and controls

129 lines (106 loc) · 2.6 KB
title TOCTitle ms:assetid ms:mtpsurl ms:contentKeyID ms.date mtps_version f1_keywords f1_categories ms.localizationpriority
Convert DAO code to ADO
Convert DAO code to ADO
4720906b-d6b1-aa6d-3b18-ff828d16acae
48544585
10/16/2018
v=office.15
vbaac10.chm5267115
Office.Version=v15
high

Convert DAO code to ADO

Applies to: Access 2013, Office 2013

Note

Versions of the DAO library prior to 3.6 are not provided or supported in Access.

DAO to ADO object map

DAO

ADO (ADODB)

Note

DBEngine

None

Workspace

None

Database

Connection

Recordset

Recordset

Dynaset-Type

Keyset

Retrieves a set of pointers to the records in the recordset.

Snapshot-Type

Static

Both retrieve full records, but a Static recordset can be updated.

Table-Type

Keyset with adCmdTableDirect option.

Field

Field

When referred to in a recordset.

DAO

Open a Recordset

 Dim db as Database
 Dim rs as DAO.Recordset
 Set db = CurrentDB()
 Set rs = db.OpenRecordset("Employees")

Edit a Recordset

 rs.Edit 
 rs("TextFieldName") = "NewValue"
 rs.Update

ADO

Open a Recordset

 Dim rs as New ADODB.Recordset
 rs.Open "Employees", CurrentProject.Connection, _
         adOpenKeySet, adLockOptimistic

Edit a Recordset

 rs("TextFieldName") = "NewValue" 
 rs.Update

Note

Moving focus from current record via MoveNext, MoveLast, MoveFirst, MovePrevious without first using the CancelUpdate method implicitly executes the Update method.

About the contributors

Link provided by the UtterAccess community. UtterAccess is the premier Microsoft Access wiki and help forum.