I have a project with two (2) back-end files.
And have hobbled together the below code to check if anyone else has either of those files open (so that, if no one does, it can be update...) Admittedly, there are a few, but significant lines, that I have no comprehension of at all =:- (
What I did however, was create code that generates who has the current (Front End) project open, not either of the linked (BE) files (...would only need to know who has one of the BE files open at a time; never both)
...return to the internet I go; and now my head spins (probably because the discussions are 2-steps (not 1) above how much i know / understand...)
Would you direct me an how to adjust the code to generate a list of users for the Back-End files (plz) ?
Code:
Sub ShowUserRosterMultipleUsers()
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim db As Dao.Database
Dim tbl As TableDef, fld
Set cn = CurrentProject.Connection
Set db = CurrentDb
Set tbl = db.CreateTableDef("Users")
Set fld = tbl.CreateField("User", dbText)
' 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 database.
gsMsgText = ""
Debug.Print rs.Fields(0).Name, "", rs.Fields(1).Name, _
"", rs.Fields(2).Name, rs.Fields(3).Name
If Not rs.EOF And rs.BOF Then
rs.MoveFirst
End If
While Not rs.EOF
Debug.Print rs.Fields(0), rs.Fields(1), rs.Fields(2), rs.Fields(3)
If Len(gsMsgText) > 0 Then
gsMsgText = gsMsgText & vbCrLf
End If
gsMsgText = gsMsgText & Replace(Trim(rs.Fields(0)), Chr(0), "") & " " _
& Replace(Trim(rs.Fields(1)), Chr(0), "")
rs.MoveNext
Wend
If Len(gsMsgText) = 0 Then
gsMsgTitle = "LIST OF ACTIVE USERS"
gsMsgText = "no one else is using the file"
End If
gsMsgResponse = MsgBox(gsMsgText, vbInformation, gsMsgTitle)
End Sub
as always,
with appreciation in advance,
m.