ACC95: NewPassword Method Doesn't Update Current Session

ID: Q149219


The information in this article applies to:


SYMPTOMS

Advanced: Requires expert coding, interoperability, and multiuser skills.

After using the NewPassword method to change a user's password, the user is unable to access objects for which he or she has permissions. The user receives the error message "Not a valid account name or password."


RESOLUTION

There are two possible workarounds for this error message.

Workaround 1

You can avoid the error message by using the user interface to a change password instead of the NewPassword method in Visual Basic for Applications. Here are the basic steps:
  1. On the Tools menu, click Security.


  2. Click User and Group Accounts.


  3. Click the Change Logon Password tab.


  4. Enter a new password using the Old Password, New Password, and Verify boxes, and then click OK.


Workaround 2

After you use the NewPassword method, you can restart Microsoft Access, which allows you to log on using the new password. Because you have logged on again, you do not receive the error message. To do so, follow these steps:
  1. Exit Microsoft Access and restart the program.


  2. In the logon box, enter your new password and click OK.



MORE INFORMATION

Microsoft has confirmed this to be a problem in Microsoft Access version 7.0. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

Steps to Reproduce Behavior


  1. Start Microsoft Access and log in as Admin (or another user with Administer permissions).


  2. On the Tools menu, click Security, and then click User and Group Accounts. Create a new user, and let this user be a member of the Admins group.


  3. Create the following new form:
    
          Form: ChangePassword
          -----------------------
          Caption: ChangePassword
    
          Textbox:
             Name: OldPwd
             ControlSource:
    
          Textbox:
             Name: NewPwd
             ControlSource: 

    Change the captions of the corresponding labels of the text boxes to Old and New.
    
          Command button:
             Name: Button0
             Caption: My Button
             OnClick: [Event Procedure]
    
          Set the Onclick property to the following [Event Procedure] 
    
             Private Sub Command0_Click()
                Dim ws as Workspace
                Set ws = DBEngine.Workspaces(0)
                ws.Users(CurrentUser()).NewPassword [OldPwd], [NewPwd]
                ws.Close
             End Sub 


  4. Close and save the form.


  5. Quit Microsoft Access.


  6. Restart Microsoft Access and log in as the new user.


  7. Open the ChangePassword form.


  8. Enter the following into the text boxes:
    Old: ""
    New: abc


  9. Click the command button to update the password.


  10. Close the ChangePassword form.


  11. Open the Categories form. Note that the error message "Not a valid account name or password" appears, and you are unable to open the form.



REFERENCES

Microsoft Access "Building Applications," version 7.0, Chapter 14, "Securing and Delivering Your Application", pages 328-339.


Keywords          : kberrmsg kbusage ScrtUsr 
Version           : 7.0
Platform          : WINDOWS 
Issue type        : kbprb 

Last Reviewed: April 27, 1999