Microsoft KB Archive/149219

= ACC95: NewPassword Method Does Not Update Current Session =

Article ID: 149219

Article Last Modified on 1/26/2005

-

APPLIES TO


 * Microsoft Access 95 Standard Edition

-



This article was previously published under Q149219



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
 Start Microsoft Access and log in as Admin (or another user with Administer permissions). 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.  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  Close and save the form. Quit Microsoft Access.</li> Restart Microsoft Access and log in as the new user.</li> Open the ChangePassword form.</li> Enter the following into the text boxes:

Old: ""

New: abc

</li> Click the command button to update the password.</li> Close the ChangePassword form.</li> 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.</li></ol>

<div class="references_section">