Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Latest commit

 

History

History
25 lines (14 loc) · 1.57 KB

create-a-dao-recordset-from-a-form.md

File metadata and controls

25 lines (14 loc) · 1.57 KB
title ms.prod ms.assetid ms.date
Create a DAO Recordset From a Form
access
d4bbe327-217d-ba7e-3d9f-3c89af1dcbc9
06/08/2017

Create a DAO Recordset From a Form

You can create a Recordset object based on an Access form. To do so, use the RecordsetClone property of the form. This creates a dynaset-type Recordset that refers to the same underlying query or data as the form. If a form is based on a query, referring to the RecordsetClone property is the equivalent of creating a dynaset with the same query. You can use the RecordsetClone property when you want to apply a method that cannot be used with forms, such as the FindFirst method. The RecordsetClone property provides access to all the methods and properties that you can use with a dynaset.

The following example shows how to assign a Recordset object to the records in the Orders form.

Dim rstOrders As DAO.Recordset 
 
Set rstOrders = Forms!Orders.RecordsetClone 

This code always creates the type of Recordset being cloned (the type of Recordset on which the form is based); no other types are available. Note that the Recordset object is declared with the object library qualification. Because Access can use both DAO and ADO, it is better to fully qualify the data access variables by including the object library reference name.