R
Rachiano
Hi,
I have been using the code listed below for a few years and everything
worked o.k.
But not long ago I found out that it doesn's work anymore. I use it to
implement security based on groups within a .mdw file. Can anyone give me an
idea of what is happening? The error I get is:
Run-time error '13':
Type mismatch
I have to mention that I develop in Access XP, but when running the program
in Access 2003 I get the error.
----------------
Dim catDB As ADOX.Catalog
Dim usr As ADOX.User
Dim grp As ADOX.Group
Set catDB = New ADOX.Catalog
With catDB
..ActiveConnection = CurrentProject.Connection
For Each grp In .Groups
'===If the user belongs to the management group===
If grp = "management" Then
For Each usr In grp.Users
If CurrentUser = usr.Name Then
Me.DataBestand.Locked = False
Me.Command66.Enabled = True
Me.Command35.Enabled = True
Else
End If
Next usr
Else
End If
'===If the user belongs to the simple user group===
If grp = "SimpleUser" Then
For Each usr In grp.Users
If CurrentUser = usr.Name Then
Me.DataBestand.Locked = False
Me.Command66.Enabled = True
Me.Command35.Enabled = True
Else
End If
Next usr
Else
End If
Next grp
End With
I have been using the code listed below for a few years and everything
worked o.k.
But not long ago I found out that it doesn's work anymore. I use it to
implement security based on groups within a .mdw file. Can anyone give me an
idea of what is happening? The error I get is:
Run-time error '13':
Type mismatch
I have to mention that I develop in Access XP, but when running the program
in Access 2003 I get the error.
----------------
Dim catDB As ADOX.Catalog
Dim usr As ADOX.User
Dim grp As ADOX.Group
Set catDB = New ADOX.Catalog
With catDB
..ActiveConnection = CurrentProject.Connection
For Each grp In .Groups
'===If the user belongs to the management group===
If grp = "management" Then
For Each usr In grp.Users
If CurrentUser = usr.Name Then
Me.DataBestand.Locked = False
Me.Command66.Enabled = True
Me.Command35.Enabled = True
Else
End If
Next usr
Else
End If
'===If the user belongs to the simple user group===
If grp = "SimpleUser" Then
For Each usr In grp.Users
If CurrentUser = usr.Name Then
Me.DataBestand.Locked = False
Me.Command66.Enabled = True
Me.Command35.Enabled = True
Else
End If
Next usr
Else
End If
Next grp
End With