You Must use dbseechanges option with openrecordset Error

jo15765

Registered User.
Local time
Yesterday, 22:23
Joined
Jun 24, 2011
Messages
130
I am trying to run queries in other databases by using the following code:
Code:
'Opening the Database
Set db = DBEngine.Workspaces(0).OpenDatabase("C:\Test\Test12\Testdb.mdb")
'Running specified queries
db.Execute "qry_try_This", dbFailOnError
Set db = Nothing

But I keep getting the error of:
Run time error 3622
You must use dbseechanges option with openRecordset option when accessing a SQL server table that has an Identity column

I am by far a beginner using DAO, and am not sure what exactly is causing this error, or how to correct it.
 
Disregard, I added + dbSeeChanges to the end of the dbfail statement and now it is running like a dream!!

For anyone else experiencing the same problem the code should read like this:
Code:
'Opening the Database Set db = DBEngine.Workspaces(0).OpenDatabase("C:\Test\Test123\Test123db.mdb") 
'Running specified queries 
db.Execute "qry_check_weekly_statistics", dbFailOnError + dbSeeChanges  
Set db = Nothing..
 
Last edited:
you need this flag with SQL data sources (at least), but not Jet - not sure what other back ends would need it.
 
With Jet, I think you need it if you're using dbInconsistent.
 

Users who are viewing this thread

Back
Top Bottom