C
Casey
Hi,
Below I have a function that I have set in with the
class modules of my form as a public function. On this
form I have the fields [name1] and [group1]. Please don't
credit me with developing the structure of the function
because I received the framework of it in response to an
earlier newsgroup question.
I want to use the variable that is created by the
public function in an If statement within a Sub Procedure,
to determine whether a msgbox saying the "User has been
deleted from group." will show if the variable from the
public function is false. Nothing happens though. I am
presuming that the variable from the public function is
IIG.
I would appreciate any advice on this.
Thank you,
Casey
Directly below is the Function
Public Function IsInGroup(UsrName As String, GrpName As
String) As Boolean
Dim grp As Group
Dim IIG As Boolean
Dim usr As User
IIG = False
For Each usr In DBEngine.Workspaces(0).Users
If usr.Name = [Name1] Then GoTo FoundUser
Next
GoTo IIG_Exit
FoundUser:
For Each grp In usr.Groups
If grp.Name = [Group1] Then IIG = True
Next
IIG_Exit:
IsInGroup = IIG
End Function
Below here is the sub procedure
Private Sub Command174H_Click()
Dim ws As Workspace
Dim grpVp As Group, grpmanager As Group
Dim usr As User
Set ws = DBEngine.Workspaces(0)
Set grpmanager = ws.Groups([Group1])
grpmanager.Users.Delete ([Name1])
If IIG = false then
msgbox "User has been deleted from group."
Endif
End Sub
Below I have a function that I have set in with the
class modules of my form as a public function. On this
form I have the fields [name1] and [group1]. Please don't
credit me with developing the structure of the function
because I received the framework of it in response to an
earlier newsgroup question.
I want to use the variable that is created by the
public function in an If statement within a Sub Procedure,
to determine whether a msgbox saying the "User has been
deleted from group." will show if the variable from the
public function is false. Nothing happens though. I am
presuming that the variable from the public function is
IIG.
I would appreciate any advice on this.
Thank you,
Casey
Directly below is the Function
Public Function IsInGroup(UsrName As String, GrpName As
String) As Boolean
Dim grp As Group
Dim IIG As Boolean
Dim usr As User
IIG = False
For Each usr In DBEngine.Workspaces(0).Users
If usr.Name = [Name1] Then GoTo FoundUser
Next
GoTo IIG_Exit
FoundUser:
For Each grp In usr.Groups
If grp.Name = [Group1] Then IIG = True
Next
IIG_Exit:
IsInGroup = IIG
End Function
Below here is the sub procedure
Private Sub Command174H_Click()
Dim ws As Workspace
Dim grpVp As Group, grpmanager As Group
Dim usr As User
Set ws = DBEngine.Workspaces(0)
Set grpmanager = ws.Groups([Group1])
grpmanager.Users.Delete ([Name1])
If IIG = false then
msgbox "User has been deleted from group."
Endif
End Sub