Dynaset Object

See AlsovbobjDynasetSee              PropertiesvbobjDynasetProp           Methods0YWU9YG

Description

A type of recordset22S7WAF that is the result of a query and that can have updatable records.  Like a Table, a Dynaset has records (rows) and fields (columns).  A Dynaset is a dynamic set of records you can use to add, change, and delete records from the underlying table or tables.  A Dynaset can contain fields from one or more tables in a database.

Remarks

A data control opens a Database and then creates a Dynaset, using the RecordSource property.  The RecordSource property can be the name of a Table or QueryDef in the Database, or it can be an SQL statement29F05E5.  The Recordset property of a data control is a reference to its underlying Dynaset object.  You can use any property or method of a Dynaset with a data control's Recordset property.

The default collection of a Dynaset is the Fields collection, and the default property of a Field is the Value property.  For example, using the defaults, the following statements are identical:

Data1.Recordset.Fields("PubID").Value = 99
Data1.Recordset("PubID") = 99

 

In a multiuser environment, various users can open Dynasets referring to the same records.  Because a Dynaset is dynamic, when one user changes a record, other users have immediate access to the changed data.  If a user adds a record, the change is not reflected for any other user until the other user's Dynaset is recreated using the Refresh method.  If a user deletes a record, other users are notified when they try to access that record.  To maintain the integrity of your data, records are locked during Edit and Update operations so that several users can't update the same record at the same time.  There are two kinds of locking: pessimistic4CZD0Q2 and optimistic101JIVM.

Not all Fields can be updated in all Dynasets.  Use the Updatable property of a Field to discover if it is updatable.

Professional Edition

In the Professional Edition, you can also declare an object variableZ3R9Q5 as a Dynaset type.  To create a Dynaset for an object variable, you would use the CreateDynaset method on a Database or another Dynaset.  You can have more than one object variable that refers to the same set of records.  Also, keep in mind that object variables created with the Dim statement in the Declarations section of a form exist only while the form is open, and are closed when the form unloads.  In the same way, object variables created in a procedure exist only until the procedure has finished.

You can also create a copy of a Dynaset with the Clone method.  This takes less memory than creating a new Dynaset on the same records, and enables you to use the same bookmarks for both.