• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1324
  • Last Modified:

Openrecordset Options question

I had been using this statement:
Set rst = db.OpenRecordset(strSQL2, dbOpenDynaset, dbInconsistent)

I added an identity field to the linked sql table, now I get an error saying I need to add dbseechanges.

How to I use the dbInconsistent & the dbseechanges option?

1 Solution
Guy Hengel [angelIII / a3]Billing EngineerCommented:
you cannot use both at the same time. you have to use either dbInconsistent OR dbSeechanges, and as you are told by the message, you now have actually no choice.
Set rst = db.OpenRecordset(strSQL2, dbOpenDynaset, dbInconsistent + dbseechanges)
From what I gather you have to use dbSeeChanges for any table that has a IDENTITY column.

Some further info for you, just in case you wondering what the options are - Note, this is not an answer, as they answers have already been supplied. its just some info for you, ignore if you already know.

2nd parameter

dbOpenTable - Opens a table-type Recordset object (Microsoft Jet workspaces only).
dbOpenDynamic - Opens a dynamic-type Recordset object, which is similar to an ODBC dynamic cursor. (ODBCDirect workspaces only)
dbOpenDynaset - Opens a dynaset-type Recordset object, which is similar to an ODBC keyset cursor.
dbOpenSnapshot - Opens a snapshot-type Recordset object, which is similar to an ODBC static cursor.
dbOpenForwardOnly - Opens a forward-only-type Recordset object.

3rd Parameter

dbAppendOnly - Allows users to append new records to the Recordset, but prevents them from editing or deleting existing records (Microsoft Jet dynaset-type Recordset only).
dbSQLPassThrough - Passes an SQL statement to a Microsoft Jet-connected ODBC data source for processing (Microsoft Jet snapshot-type Recordset only).
dbSeeChanges - Generates 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.
dbDenyWrite - Prevents other users from modifying or adding records (Microsoft Jet Recordset objects only).
dbDenyRead - Prevents other users from reading data in a table (Microsoft Jet table-type Recordset only).
dbForwardOnly - Creates 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.
dbReadOnly - Prevents 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.
dbRunAsync - Runs an asynchronous query (ODBCDirect workspaces only).
dbExecDirect - Runs 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."
dbInconsistent - Allows inconsistent updates (Microsoft Jet dynaset-type and snapshot-type Recordset objects only).
dbConsistent - Allows only consistent updates (Microsoft Jet dynaset-type and snapshot-type Recordset objects only).

The constants dbConsistent and dbInconsistent are mutually exclusive, and using both causes an error.
NLGroupAuthor Commented:
Thanks everyone!

Featured Post


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now