cn.OpenSchema SUSPECT_STATE (1 Viewer)

BiigJiim

Registered User.
Local time
Today, 00:43
Joined
Jun 7, 2012
Messages
114
Hi use the following to return a recordset of users connected to an Access 2010 database. All works fine. My question is: it returns a field called SUSPECT_STATE which I ignore. Can anyone tell me what this field represents and in what conditions it is set?

Many thanks,
Jim

Here's the code:

Dim cn As New adodb.Connection
Dim rs As New adodb.Recordset

Const conDatabase As String = <full database path>

' Open connection to Access backend
cn.Open "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & conDatabase & ";Persist Security Info=False;"

' Open recordset
Set rs = cn.OpenSchema(adSchemaProviderSpecific, , "{947bb102-5d43-11d1-bdbf-00c04fb92675}")
 

NauticalGent

Ignore List Poster Boy
Local time
Yesterday, 19:43
Joined
Apr 27, 2015
Messages
6,341
your code is incomplete: <full database path> should be replaced with the actual path to your DB.

Is there a reason you are using ADOdb instead of DAO? Are you linking to an external source like SQL?
 

cheekybuddha

AWF VIP
Local time
Today, 00:43
Joined
Jul 21, 2014
Messages
2,280
IIRC, Suspect State is used for SQLServer connections - but I could well be wrong.
 

HiTechCoach

Well-known member
Local time
Yesterday, 18:43
Joined
Mar 6, 2006
Messages
4,357
When an Access application connected to a database does something to cause JET/ACE to flag the database for a need to be required, the Suspect State can often be set to True for the possible offender.

If the Suspect State is every set to true, I have often have found there is a reason for concern.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Yesterday, 18:43
Joined
Feb 28, 2001
Messages
27,184
Regarding "suspect state" I found some references.

This reference suggests that "SUSPECT STATE" is the indicator that database recovery is needed. (See "4. Multi-user Access")


More than one reference implies (but never actually confirms) that "SUSPECT_STATE" is a DB flag that is set before Access starts any DB udpate of the BE file and clears that flag when the write-back is complete. The main implication is that if Access does not get back to the DB to reset the flag, then it knows the DB write-back was not completed, and that is one of the sure-fire causes of corruption.


There are articles for SQL Server as a Back End that also mention SUSPECT states:


Some of the references only refer to JET (which makes them pretty old by now.) Others refer to ACE and the last of my links is a 2019 reference to SQL Server, so that is not very old at all.
 

isladogs

MVP / VIP
Local time
Today, 00:43
Joined
Jan 14, 2017
Messages
18,221
The code to check the JET roster of database users dates back to Access 97 at least and so is now fairly ancient technology.
If the SUSPECT STATE boolean field is true, this indicates that the monitored database may be corrupt.

See Logged in users for more information
 

Users who are viewing this thread

Top Bottom