I have an Access 2000 db that I have secured with various groups and users and I am trying to run some AutoExec code straight from the Access Desktop Development book to make sure a user has a password, but unless I login as Admins, I get error 3251 at the Set usr = cat.Users(CurrentUser) line below (even when the group should have permission). I have references set to Microsoft ActiveX Data Objects 2.7 (but got the error with 2.1 as well), Microsoft ADO Ext. 2.7 for DDL and Security, as well as others. I believe my workgroup information file is setup OK. The code is:
Public Function AutoExec()
Dim cat As ADOX.Catalog
Dim usr As ADOX.User
Dim strPassword As String
Set cat = New ADOX.Catalog
cat.ActiveConnection = CurrentProject.Connection
Set usr = cat.Users(CurrentUser)
On Error Resume Next
usr.ChangePassword "", ""
If Err.Number = 0 Then
strPassword = InputBox("You Must Enter a Password Before Proceeding.", "Enter Password"
If strPassword = "" Then
DoCmd.Quit
Else
usr.ChangePassword "", strPassword
End If
End If
AutoExec = True
End Function
Does anyone know what is happening?
Thanks!
tgikristi
Public Function AutoExec()
Dim cat As ADOX.Catalog
Dim usr As ADOX.User
Dim strPassword As String
Set cat = New ADOX.Catalog
cat.ActiveConnection = CurrentProject.Connection
Set usr = cat.Users(CurrentUser)
On Error Resume Next
usr.ChangePassword "", ""
If Err.Number = 0 Then
strPassword = InputBox("You Must Enter a Password Before Proceeding.", "Enter Password"
If strPassword = "" Then
DoCmd.Quit
Else
usr.ChangePassword "", strPassword
End If
End If
AutoExec = True
End Function
Does anyone know what is happening?
Thanks!
tgikristi