CreateSnapshot Method (Professional Edition Only)

See AlsolanCreateSnapshotSee                 ExamplelanCreateSnapshotEx>Low


Creates a Snapshot object1ZLURBC from a specified table3N276AP, QueryDef19G3DMW, or SQL statement29F05E5.


Set snapshot = database.CreateSnapshot( source [, options ] )

Set snapshot = recordset.CreateSnapshot( [ options ] )


The CreateSnapshot method uses these parts:

Part                 Description


snapshot          An object variableZ3R9Q5 of type Snapshot1ZLURBC.

database          Object variable identifying an open database or the Database property of a data control.

recordset          Object variable identifying an existing recordset22S7WAF object or the Recordset property of a data control.

querydef           Object variable identifying an existing QueryDef object.

source              String expression1330R89 that is the name of an existing recordset, QueryDef or SQL statement.

options             A numeric expression71RISN indicating one or more option settings.  Values can be combined by adding them together.  See table below for option values.


You can use 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 environment, others cannot make changes to records in any table in your Snapshot while you have it open.  Use for administrative purposes only.

DB_SQLPASSTHROUGH    64          For Snapshots created with an SQL statement, this value causes the SQL statement to be passed to an ODBC database for processing, as when creating a Snapshot on tables in a SQL Server or Oracle database.  Ignored except for ODBC remote databases.


Unlike the data in a Dynaset, the data in a Snapshot isn't linked to its underlying tables.  The data in a Snapshot doesn't change even if the data in its underlying tables changes.  Further, you cannot change the data in a Snapshot.

When applied to a Dynaset or Snapshot, CreateSnapshot returns a Snapshot containing records filtered and sorted according to the Dynaset or Snapshot object's Filter and Sort properties.  The contents of the original Dynaset or Snapshot aren't affected.

When applied to a QueryDef, CreateSnapshot executes the QueryDef and returns a Snapshot that is a copy of the data defined by the QueryDef.  If you use CreateSnapshot on an actionKV0EYL QueryDef an error occurs (use the Execute method for action QueryDef objects).

To use CreateSnapshot on a QueryDef that has parameters, first open the QueryDef and set the parameters.  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.