Module of Multiple Users

G

Guest

The IsUserInGroup is working fine (detailed in post below). Now I am trying
another module with the following:

Function MultipleUsers() As String
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=" & Chr(34) & "N:\Common\DATAPROC\Computer
Operations.mdb" _
& Chr(34)

cn2.Open "Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=" & Chr(34) & "N:\Common\DATAPROC\Computer
Operations.mdb" _
& Chr(34)

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

rs.MoveFirst
If Trim(rs.Fields(1)) = "Admin" Then
rs.MoveNext
Else: MultipleUsers = Trim(rs.Fields(0))
End If
rs.MoveNext

While Not rs.EOF
If Trim(rs.Fields(1)) <> "Admin" Then
MultipleUsers = MultipleUsers & ", " & Trim(rs.Fields(0))
End If
rs.MoveNext
Wend
End Function

I found I needed to go to Tools - References to add an object library and I
added Microsoft ActiveX Data Objects 2.5 library. When I ran this function
in a query I got:

You do not have the necessary permissions to use the
N:\Common\DATAPROC\Computer Operations.mdb object. Have your system
administrator or the person who created this object establish the appropriate
permissions for you.

Which is incorrect because I created the object and I am in the Admins group
and have full permissions. Is the reference incorrect, do I need to use a
different one?

Thanks for any help. MIKE
 
D

Douglas J. Steele

See whether it works without the Chr(34) characters.

cn.Open "Data Source=N:\Common\DATAPROC\Computer Operations.mdb"
 

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