问题描述:

I'd like to know if there is a way of finding out the user names of the people sharing a database with me.

I know that I can use the environ("UserName") call to get my own username but I'd like to know who else is in the database.

网友答案:

This sample sub, which uses a provider-specific schema, will list users. You need to pass a valid connection, for example:

ADOUserList Currentproject.Connection

  Public Sub ADOUserList(oConn As ADODB.Connection)
  Dim rs As ADODB.Recordset
      Set rs = oConn.OpenSchema(adSchemaProviderSpecific, , _
          "{947bb102-5d43-11d1-bdbf-00c04fb92675}")
      Debug.Print rs.GetString
      rs.Close
  End Sub

The fields returned are:

COMPUTER_NAME
LOGIN_NAME
CONNECTED
SUSPECT_STATE
相关阅读:
Top