Security: Call to function crashing Access

Meltdown

Registered User.
Local time
Today, 12:53
Joined
Feb 25, 2002
Messages
472
Hi all,

Using Access 2007 on Windows 7 machine.

Every time I make a call to the following function Access crashes. Does this mean I need to re- register the MS ADO Ext 2.8 for DDL & Security dll on the machine? or is the problem elsewhere?

This seems to run fine on other PCs with the same config, just one PC giving me a problem.

Public Function ReadSecGrp(strUser As String) As String
'Purpose : Get CurrentUser's User Group

Dim cat As New ADOX.Catalog
Dim cnn As ADODB.Connection
Dim grp As ADOX.Group

' Open the catalog
Set cnn = CurrentProject.Connection
cat.ActiveConnection = cnn

For Each grp In cat.Users(strUser).Groups
If grp.Name = "Users" Then
'Skip this group.
Else
ReadSecGrp = grp.Name
End If
Next

End Function
 
i'm not sure about the ADO, and whether the code is correct.

I use DAO

but the point I wanted to make is that the code is probably not sufficient anyway. A user can be in many gropus, and his privileges are the sum of all the groups - so just checking for a single group (ie a first or maybe even a random group) is unlikely to achieve much.
 
Hi Dave,

I'm fairly suire the code is OK as I've been using it a long time on a number of databases, I'm just not sure why it's causing one particular PC to crash any time it's called.

For manageability, my users are only ever in one active group, 'Users' being a disabled group.

Thanks for the reply.

Regards
Melt
 

Users who are viewing this thread

Back
Top Bottom