CreateDynaset Method (Professional Edition Only)
See Also Example
Description
Creates a Dynaset object
Syntax
Set dynasetobject = database.CreateDynaset( source [, options ] )
Set dynasetobject = { recordset | querydef }.CreateDynaset( [ options ] )
Remarks
The CreateDynaset method uses these parts:
Part Description
dynasetobject Object variable of type Dynaset.
database Object variable identifying an open database or the Database property of a data control.
recordset Object variable identifying an existing recordset object or the Recordset property of a data control.
querydef Object variable identifying an existing QueryDef object.
source String expression that is the name of an existing recordset, QueryDef or SQL statement.
options A numeric expression indicating one or more option settings. Values can be combined by adding them together. See table below for option values.
You can supply one or a combination of the following symbolic constants and values (from DATACONS.TXT) in the options part:
Constant Value Description
DB_DENYWRITE 1 In a multiuser or multitasking environment, others cannot make changes to any records in any table in your Dynaset while you have it open. Use for administrative purposes only.
DB_READONLY 4 You cannot make changes to records in your Dynaset. This can increase speed of some operations.
DB_APPENDONLY 8 You can only add new records to the Dynaset. You cannot read or update existing records.
DB_INCONSISTENT 16 Updates can apply to all fields of the Dynaset, even if they also affect other rows of the Dynaset.
DB_CONSISTENT 32 (Default) Updates apply only to those fields that will not affect other rows of the Dynaset.
DB_SQLPASSTHROUGH 64 For Dynasets created with an SQL statement, this value causes the SQL statement to be passed to an ODBC database for processing, as when creating a Dynaset on tables in a SQL Server or Oracle database. Ignored except for ODBC remote databases. The Dynaset is not updatable.
If both DB_INCONSISTENT and DB_CONSISTENT are included, or if neither are included, the result is the default.
When applied to a Dynaset or Snapshot It doesn't affect the contents of the first Dynaset or Snapshot.
To create a Dynaset from a QueryDef that has parameters, open the QueryDef, set the parameters, and then use CreateDynaset. You set the parameters of a QueryDef using the following syntax:
querydef ! parameter = parametervalue
When you only want to read data and not change data, a Snapshot object is faster than a read-only Dynaset object. However, a read-only Dynaset will reflect changes made by others while you are using it. A Snapshot will not.
Note If your program requires two identical Dynasets, it is more efficient to create a single Dynaset and then use the Clone method to create a second reference.