Dynaset Property

Applies To

Form.

Description

You can use the Dynaset property to obtain a result set for a form’s underlying records.

Note The Dynaset property is included in this version of Microsoft Access only for compatibility with previous versions. It is recommended that you use the RecordsetClone property instead.

Setting

The Dynaset property is available only in Visual Basic and is read-only in all views.

Remarks

The Dynaset property refers to the same underlying query or data as the form. If a form is based on a query, for example, referring to the Dynaset property is the equivalent of cloning a result set with the same query. If you then apply a filter to the form, the Dynaset property reflects the filtering.

Unlike its form, the result set initially has no current record. To make the same record current in the result set, assign the value of the form’s Bookmark property to a string variable, and then set the result set’s Bookmark property to that variable. You can also use one of the Find or Move methods to make any record in the result set current.

Tip You can make the form’s current record the same as the result set’s by setting the form’s Bookmark property to the result set’s Bookmark property.

Use the Dynaset property when you want to apply a method that can’t be used with forms, such as the FindFirst method. The Dynaset property provides access to all the methods and properties that you can use with a result set.

You can use the RecordCount property to count the number of records in a result set. The following example shows how you can combine the RecordCount property with the Dynaset property to count the records in a form.


Forms![Orders].Dynaset.MoveLast"My form contains " & Forms![Orders].Dynaset.RecordCount _
    & " records.", , "Record Count"

Note If you close the form or if you change the form’s set of underlying records, the result set is no longer valid. Subsequently, if you refer to the result set or to previously saved bookmarks in the form or the result set, an error occurs.

See Also

RecordsetClone Property.