[AccessD] Re: A97 OpenRecordSet

Robert L. Stewart rl_stewart at highstream.net
Fri Oct 3 08:13:05 CDT 2003


Direct from HELP (MSA 2002):

Settings
You can use one of the following constants for the type argument.
ConstantDescription
dbOpenTableOpens a table-type Recordset object (Microsoft Jet workspaces 
only).
dbOpenDynamicOpens a dynamic-type Recordset object, which is similar to an 
ODBC dynamic cursor. (ODBCDirect workspaces only)
dbOpenDynasetOpens a dynaset-type Recordset object, which is similar to an 
ODBC keyset cursor.
dbOpenSnapshotOpens a snapshot-type Recordset object, which is similar to 
an ODBC static cursor.
dbOpenForwardOnly Opens a forward-only-type Recordset object.
Note If you open a Recordset in a Microsoft Jet workspace and you don't 
specify a type, OpenRecordset creates a table-type Recordset, if possible. 
If you specify a linked table or query, OpenRecordset creates a 
dynaset-type Recordset. In an ODBCDirect workspace, the default setting is 
dbOpenForwardOnly.
You can use a combination of the following constants for the options argument.
ConstantDescription
dbAppendOnlyAllows users to append new records to the Recordset, but 
prevents them from editing or deleting existing records (Microsoft Jet 
dynaset-type Recordset only).
dbSQLPassThroughPasses an SQL statement to a Microsoft Jet-connected ODBC 
data source for processing (Microsoft Jet snapshot-type Recordset only).
dbSeeChangesGenerates a run-time error if one user is changing data that 
another user is editing (Microsoft Jet dynaset-type Recordset only). This 
is useful in applications where multiple users have simultaneous read/write 
access to the same data.
dbDenyWritePrevents other users from modifying or adding records (Microsoft 
Jet Recordset objects only).
dbDenyReadPrevents other users from reading data in a table (Microsoft Jet 
table-type Recordset only).
dbForwardOnlyCreates a forward-only Recordset (Microsoft Jet snapshot-type 
Recordset only). It is provided only for backward compatibility, and you 
should use the dbOpenForwardOnly constant in the type argument instead of 
using this option.
dbReadOnlyPrevents users from making changes to the Recordset (Microsoft 
Jet only). The dbReadOnly constant in the lockedits argument replaces this 
option, which is provided only for backward compatibility.
dbRunAsyncRuns an asynchronous query (ODBCDirect workspaces only).
dbExecDirectRuns a query by skipping SQLPrepare and directly calling 
SQLExecDirect (ODBCDirect workspaces only). Use this option only when 
you’re not opening a Recordset based on a parameter query. For more 
information, see the "Microsoft ODBC 3.0 Programmer’s Reference."
dbInconsistentAllows inconsistent updates (Microsoft Jet dynaset-type and 
snapshot-type Recordset objects only).
dbConsistentAllows only consistent updates (Microsoft Jet dynaset-type and 
snapshot-type Recordset objects only).
Note The constants dbConsistent and dbInconsistent are mutually exclusive, 
and using both causes an error. Supplying a lockedits argument when options 
uses the dbReadOnly constant also causes an error.
You can use the following constants for the lockedits argument.
ConstantDescription
dbReadOnlyPrevents users from making changes to the Recordset (default for 
ODBCDirect workspaces). You can use dbReadOnly in either the options 
argument or the lockedits argument, but not both. If you use it for both 
arguments, a run-time error occurs.
dbPessimisticUses pessimistic locking to determine how changes are made to 
the Recordset in a multiuser environment. The page containing the record 
you're editing is locked as soon as you use the Edit method (default for 
Microsoft Jet workspaces).
dbOptimisticUses optimistic locking to determine how changes are made to 
the Recordset in a multiuser environment. The page containing the record is 
not locked until the Update method is executed.
dbOptimisticValueUses optimistic concurrency based on row values 
(ODBCDirect workspaces only).
dbOptimisticBatchEnables batch optimistic updating (ODBCDirect workspaces 
only).
Remarks
In a Microsoft Jet workspace, if object refers to a QueryDef object, or a 
dynaset- or snapshot-type Recordset, or if source refers to an SQL 
statement or a TableDef that represents a linked table, you can't use 
dbOpenTable for the type argument; if you do, a run-time error occurs. If 
you want to use an SQL pass-through query on a linked table in a Microsoft 
Jet-connected ODBC data source, you must first set the Connect property of 
the linked table's database to a valid ODBC connection string. If you only 
need to make a single pass through a Recordset opened from a Microsoft 
Jet-connected ODBC data source, you can improve performance by using 
dbOpenForwardOnly for the type argument.
If object refers to a dynaset- or snapshot-type Recordset, the new 
Recordset is of the same type object. If object refers to a table-type 
Recordset object, the type of the new object is a dynaset-type Recordset. 
You can't open new Recordset objects from forward-only–type or ODBCDirect 
Recordset objects.

At 04:13 AM 10/3/2003 -0500, you wrote:
>Date: Fri, 3 Oct 2003 10:13:00 +0100
>From: "Griffiths, Richard" <R.Griffiths at bury.gov.uk>
>Subject: [AccessD] A97 OpenRecordSet
>To: "'AccessD at databaseadvisors.com'" <AccessD at databaseadvisors.com>
>Message-ID:
>         <52339DF8DCA2A544AF660C8217EB7DCD0227F283 at MAILGATE.bury.gov.uk>
>Content-Type: text/plain
>
>Hi Group
>
>When you open a DAO recordset
>
>Set rs=db.OpenRecordSet(MySQL,dbOpenDynaset,[options],[lockedits])
>
>does anyone know the default settings for the other two parameters options
>and lockedits
>
>Many thanks
>
>Richard




More information about the AccessD mailing list