J
Jonathan Brown
I'm attempting to use a Password Changer for Admins form
that I downloaded and imported into my front end DB.
While I try to compile the code it gives me an error
message that says, "Compile error: User-defined type not
defined". I click okay and it's highlighted a statement
in the code that says: Dim ws As Workspace
If I comment the line out and attempt to compile again it
then highlights the next line of code that says: Dim
TempUser As User
If I comment that line out, then the same thing happens
for the following line of code that says: Dim TempGroup As
Group
Apparently I need to define what a "Workspace" is and
a "User" and "Group" are.
The code is included below:
Private Sub RefreshUserList_Click()
Dim J As Integer
Dim strRowSource As String
Dim strTempUser As String
Dim ws As Workspace
Dim TempUser As User
Dim TempGroup As Group
On Error GoTo ERRREFRESHUSERLIST
DoCmd.Hourglass True
Set ws = DBEngine.Workspaces(0)
Set TempGroup = ws.Groups("Users")
TempGroup.Users.Refresh
strRowSource = ""
For J = 0 To TempGroup.Users.Count - 1
Set TempUser = TempGroup.Users(J)
Select Case TempUser.Name
Case "Creator", "Engine", "Admin"
If Me!HideDefaultUsers = 0 Then strRowSource =
strRowSource & "'" & TempUser.Name & "';'" & J & "';"
Case Else
strRowSource = strRowSource & "'" &
TempUser.Name & "';'" & J & "';"
End Select
Next J
Me!UserList.RowSource = strRowSource
Me!UserList.Requery
ws.Close
DoCmd.Hourglass False
Exit Sub
ERRREFRESHUSERLIST:
ws.Close
DoCmd.Hourglass False
MsgBox "An error occured while populating the list of
users: " & Error$, vbCritical
Exit Sub
End Sub
that I downloaded and imported into my front end DB.
While I try to compile the code it gives me an error
message that says, "Compile error: User-defined type not
defined". I click okay and it's highlighted a statement
in the code that says: Dim ws As Workspace
If I comment the line out and attempt to compile again it
then highlights the next line of code that says: Dim
TempUser As User
If I comment that line out, then the same thing happens
for the following line of code that says: Dim TempGroup As
Group
Apparently I need to define what a "Workspace" is and
a "User" and "Group" are.
The code is included below:
Private Sub RefreshUserList_Click()
Dim J As Integer
Dim strRowSource As String
Dim strTempUser As String
Dim ws As Workspace
Dim TempUser As User
Dim TempGroup As Group
On Error GoTo ERRREFRESHUSERLIST
DoCmd.Hourglass True
Set ws = DBEngine.Workspaces(0)
Set TempGroup = ws.Groups("Users")
TempGroup.Users.Refresh
strRowSource = ""
For J = 0 To TempGroup.Users.Count - 1
Set TempUser = TempGroup.Users(J)
Select Case TempUser.Name
Case "Creator", "Engine", "Admin"
If Me!HideDefaultUsers = 0 Then strRowSource =
strRowSource & "'" & TempUser.Name & "';'" & J & "';"
Case Else
strRowSource = strRowSource & "'" &
TempUser.Name & "';'" & J & "';"
End Select
Next J
Me!UserList.RowSource = strRowSource
Me!UserList.Requery
ws.Close
DoCmd.Hourglass False
Exit Sub
ERRREFRESHUSERLIST:
ws.Close
DoCmd.Hourglass False
MsgBox "An error occured while populating the list of
users: " & Error$, vbCritical
Exit Sub
End Sub