Show users logged on

G

Guest

I'm fairly new to access....to please forgive me if this is an easy fix.

Basically I have set up a shared database on my company network....and ran
through the security wizard to get some basic security levels set up. As a
result of this, Access created a shortcut to my database in order to get in.

I'd like to be able to see who is currently logged into the database. I
found Microsoft's sample code for this, and tried to modify it to work for
me. I keep getting an error though because access does not recognize the
link to my database because of the shortcut. If I reference a link to the
actual database (bypassing the shortcut)....then I am told I don't have
permissions to get into the database.

Is there a way I can get around this? I'll post what I'm doing below:

Sub ShowUserRosterMultipleUsers()
Dim cn As New ADODB.Connection
Dim cn2 As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim i, j As Long

cn.Provider = "Microsoft.Jet.OLEDB.4.0"
cn.Open "Data Source=G:\Public\rebar.mdb.lnk"

cn2.Open "Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=G:\Public\rebar.mdb.lnk"

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

'Output the list of all users in the current 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
end

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top