Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why do I get error 3251 on Set usr = cat.Users(CurrentUser)?

Status
Not open for further replies.

tgikristi

Technical User
Jul 31, 2002
39
US
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
 
Straight from the MS Knowledge base:
When using ADO 2.0 or later, referencing the OriginalValue property of an ADO Field object will give the following error, if the LockType of the ADO Recordset is Read Only:

Run-time error '3251': The operation requested by the application is not supported by the provider.
To avoid this error in ADOVB, comment out or remove the following line of code, in the Click event procedure for cmdAccess in the code window for frmADOVB:

This was at this address:
hth
 
I had seen this on the microsoft site when I did a search for the 3251 error, but since I didn't think I was referencing an 'OriginalValue', I didn't think it applied. I'm still not sure how this code is referencing an 'OriginalValue'. It is probably beyond me! Thanks anyway.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top