Run-Time Error '3251'

zyousafi

Registered User.
Local time
Today, 15:30
Joined
Jun 13, 2010
Messages
39
The following code, in red text, is giving me the attached error:

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

Set cn = CurrentProject.Connection

' 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 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
Wend

End Sub​

I have searched this code on Google and found the exact same code from multiple sources so that leads me to believe the code is correct; however why am I getting this error then?
 

Attachments

  • Run-Time Error '3251'.jpg
    Run-Time Error '3251'.jpg
    92.6 KB · Views: 228

Users who are viewing this thread

Back
Top Bottom