Security

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
 
R

Rob Oldfield

Whatever reference you have to ADOX on one machine isn't on the other. Go
to a Tools, References window from code and see what's missing.
 
R

Rachiano

Hi Rob,
I have compared the references from both machines and they are the same.
What I have done is installed the latest MDAC (2.8) on the machine with the
access 2003 version, restarted the pc and restarted my application.
Now everything works without a problem!
So it looks like the latest MDAC did something.
Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top