Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

User And Group Accounts

Status
Not open for further replies.

Informatic

Programmer
Oct 4, 2002
34
DE
Hi
I don't want to use User And Group Accounts Dialog in Access.
I want to make User And Group Accounts Form with VBA.
Have somebody done something like that or is there any VBA code in Iternet
 
I have a database all built for this... if interested in this i would be happy to email it to you... send me an email with the request and i'll send it along...

--James
junior1544@jmjpc.net
Life is change. To deny change is to deny life.
 
Here is a function that you can paste into the standard module and then use as the data source on a listbox in your Form. Put in the Row Source Type as UserGroupList

Function UserGroupList(fld As Control, ID As Variant, _
rowX As Variant, col As Variant, _
code As Variant) As Variant
Dim ur As User, gp As Group
Static myarray() As Variant
Static row As Integer, rowcount As Integer
Dim cg As New ADOX.Catalog

Dim ReturnVal As Variant
ReturnVal = Null

Select Case code
Case acLBInitialize ' Initialize.
Set cg.ActiveConnection = CurrentProject.Connection
rowcount = cg.Users.Count
row = 0
ReDim Preserve myarray(rowcount, 2)
For Each ur In cg.Users
myarray(row, 0) = ur.Name
For Each gp In ur.Groups
myarray(row, 1) = gp.Name
Next
row = row + 1
If row = rowcount Then Exit For
Next
ReturnVal = rowcount

Case acLBOpen ' Open.
' Generate unique ID for control.
ReturnVal = Timer
Case acLBGetRowCount ' Get number of rows.
ReturnVal = rowcount
Case acLBGetColumnCount ' Get number of columns.
ReturnVal = 2
Case acLBGetColumnWidth ' Column width.
' -1 forces use of default width.
ReturnVal = -1

Case acLBGetValue ' Get data.
'-- zero based array
'Select Case col
' Case 0
' ReturnVal = myarray(rowX, 0)
' Case 1
' ReturnVal = myarray(rowX, 1)
'End Select
ReturnVal = myarray(rowX, col)
Debug.Print "column = "; col

Case acLBEnd ' End.
Erase myarray
End Select
'''''Debug.Print "return value = "; ReturnVal
UserGroupList = ReturnVal
End Function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top