Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2004
    Location
    Oxfordshire, UK
    Posts
    89

    Unanswered: Trouble With ADOX User.ChangePassword

    Hi All,

    I'm I'm constructing an alternative security interface in an Access 2K file-server app (both files are secured using a custom workgroup information file). I cannot get the following ADO to work, where DAO equivalents work well:

    Dim catCurrent As ADOX.Catalog
    Dim usrCurrent As ADOX.User

    Set catCurrent = New ADOX.Catalog
    Set catCurrent.ActiveConnection = CurrentProject.Connection
    Set usrCurrent = catCurrent.Users(cmbUserID)
    usrCurrent.ChangePassword txtOldPassword, txtNewPassword

    The line Set usrCurrent = catCurrent.Users(cmbUserID) throws up "Error 3265: Item cannot be found in the collection corresponding to the requested name or ordinal". This occurs even when cmbUserID is set to the current User (CurrentProject.Connection.Properties("User Id"))! ADOX Version 2.8 is referenced.

    Anyone got any ideas?


    Ian

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Hi Ian

    I've been merrily changing my password willy nilly using your code however I don't have a work group file so this might be the complication. Why not use your usrCurrent object as an iterant of the Users colection of the connection object and check if it matches cmbUserID at each pass. If not then there is something wrong eg. (some misc code in there as I've been playing around)

    Code:
    	Dim catCurrent As ADOX.Catalog
    	Dim usrCurrent As ADOX.User
    	Dim cmbUserID As String
    	Dim txtOldPassword As String
    	Dim txtNewPassword As String
    	
    	txtNewPassword = "Password"
    	
    	Set catCurrent = New ADOX.Catalog
    	Set catCurrent.ActiveConnection = CurrentProject.Connection
    	'cmbUserID = "admin"
    	
    	cmbUserID = CurrentProject.Connection.Properties("user id")
    	
    	For Each usrCurrent In catCurrent.Users
    		
    		Debug.Print usrCurrent.Name 
    		
    		If usrCurrent.Name = cmbUserID Then MsgBox "Eureka!"
    
    	Next usrCurrent
    	
    	Set usrCurrent = catCurrent.Users(cmbUserID)
    	usrCurrent.ChangePassword txtOldPassword, txtNewPassword
    Testimonial:
    pootle flump
    ur codings are working excelent.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •