How do I find out who the other user is that has my access file o.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Regarding Access....

How do I find out programmatically who the other users are that has the
access file open?
 
How do I find out programmatically who the other users are that has the
access file open?

Hi Trish,

I don't have any personal experience with this task, but see if these links help.
These deal with finding out who is using the database and ways to log them off.
Watch out for any possible line wrapping on these links!

http://www.datastrat.com/Download2.html
Look for KickEmOff2K sample database.

http://www.rogersaccesslibrary.com/download2k.asp?SampleName='LogUsersOff2k.mdb'

http://www.rogersaccesslibrary.com/download2k.asp?SampleName='LogUsersOffNonUse2k.mdb'

http://support.microsoft.com/?id=198755

http://support.microsoft.com/?id=285822

http://www.candace-tripp.com/_pages/access_downloads.asp
Look for Detect and Logoff Idle Users

http://propertychampion.com/Developer_Tools/Addins/Addins.html
Look for "Force User Out"

"Who's Logged In" Sample Database:
http://www.rogersaccesslibrary.com/misc/Whoson.97

http://www.fmsinc.com/products/Admin/index.asp

Hope that helps,
 
Additionally, Jeff, I previously wrote a subroutine that can be put in a
front end
database and run from the Immediate Window; it's based on KB article 285822.
It will tell you who (including you) currently is "in" the backend database
to which the front end is linked.


'*******************************************
'* Subroutine WhoIsInTheDatabaseLockFile *
'*******************************************

Public Sub WhoIsInTheDatabaseLockFile()
' Written by Ken Snell (January 31, 2005)

' *** OUTPUTS A LIST OF USERS IN THE DATABASE:
' *** 1. COMPUTER NAME ("COMPUTER NAME")
' *** 2. LOGON NAME ("LOGIN_NAME")
' *** 3. WHETHER USER IS STILL CONNECTED TO THE DB (USER ID
' *** REMAINS IN .LDB FILE UNTIL LAST USER EXITS OR
' *** UNTIL THE SLOT IS CLAIMED BY ANOTHER USER)
' *** ("CONNECTED")
' *** 4. WHETHER USER'S CONNECTION TERMINATED UNDER NORMAL
' *** CIRCUMSTANCES ("SUSPECT_STATE")

' *** ADAPTED FROM MICROSOFT KNOWLEDGE BASE ARTICLE 285822

Dim cn As New ADODB.Connection
Dim dbs As DAO.Database
Dim rs As New ADODB.Recordset
Dim strNewDataSource As String, strCNString As String
Dim strCurrConnectString As String

' Replace the string in the next step with the name of a real
' linked table in the database
Const strLinkedTableName As String = "Name_of_A_Linked_Table"

Const strDatabaseString As String = "DATABASE="
Const strDataSourceText As String = "Data Source="

On Error GoTo Err_Msg

strCurrConnectString = CurrentProject.Connection
strCNString = Mid(strCurrConnectString, InStr(strCurrConnectString, _
strDataSourceText) + Len(strDataSourceText))
strCNString = Left(strCNString, InStr(strCNString, ";") - 1)

Set dbs = CurrentDb
strNewDataSource = dbs.TableDefs(strLinkedTableName).Connect
strNewDataSource = Mid(strNewDataSource, InStr(strNewDataSource, _
strDatabaseString) + Len(strDatabaseString))
Debug.Print "File containing the data tables: " & strNewDataSource

cn.ConnectionString = Replace(strCurrConnectString, strCNString, _
strNewDataSource, 1, 1, vbTextCompare)
cn.Open

' The user roster is exposed as a provider-specific schema rowset
' in the Jet 4.0 OLE DB provider. You have to use a GUID to
' reference the schema, as provider-specific schemas are not
' listed in ADO's type library for schema rowsets

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

'Output the list of all users in the designated database.

Debug.Print rs.Fields(0).Name, "", rs.Fields(1).Name, _
"", rs.Fields(2).Name, rs.Fields(3).Name

While Not rs.EOF
Debug.Print rs.Fields(0), rs.Fields(1), _
rs.Fields(2), rs.Fields(3)
rs.MoveNext
Wend

Exit_Sub:
On Error Resume Next
rs.Close
Set rs = Nothing
cn.Close
Set cn = Nothing
dbs.Close
Set dbs = Nothing
Exit Sub

Err_Msg:
Debug.Print "Error occurred. Error number " & Err.Number & ": " &
Err.Description
Resume Exit_Sub

End Sub
 
Additionally, Jeff, I previously wrote a subroutine that can be put in a
front end database and run from the Immediate Window; it's based on KB article 285822.
It will tell you who (including you) currently is "in" the backend database
to which the front end is linked.

<Code Snipped>

Ohhhh that's cool Ken!
Mind if I add that to my NG response message text for future messages?
 
That is fine with me. One of these days, I plan to put it (and lots of other
code snippets, etc.) on a website.
 
That is fine with me. One of these days, I plan to put it (and lots of other
code snippets, etc.) on a website.

That'll be one to bookmark for sure!!

John W. Vinson[MVP]
 
Back
Top