Microsoft KB Archive/203887

= ACC2000: How to Clear the Last User Name from the Logon Dialog Box =

Article ID: 203887

Article Last Modified on 6/28/2004

-

APPLIES TO


 * Microsoft Access 2000 Standard Edition

-



This article was previously published under Q203887



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

This article applies only to a Microsoft Access database (.mdb).



SUMMARY
When you start Microsoft Access in a secured database environment, you are prompted by the Logon dialog box to log on to the database before you can open it. The Name box in the Logon dialog box is populated with the name of the last user who logged on to the database. This article demonstrates a method to prevent the last user name from appearing in the Name box.



MORE INFORMATION
With any Access database, Microsoft Access stores the name of the last user to have accessed the database in the Windows registry. When you implement Access Security, the name of the last user appears in the Logon dialog box whenever the database is opened.

To prevent the last user's name from appearing in the Name box of the Logon dialog box, create a shortcut that includes the /user switch, but which does not include the name of a user. For an example of how to do this, follow these steps. This example assumes that Northwind.mdb is the secured database, and it creates a shortcut based on this assumption.  Right-click the Windows desktop where you intend to open and use your secured Microsoft Access database. Point to New, and then click Shortcut. On the first page of the Create Shortcut Wizard, type the following command line, and then click Next:

"C:\Program Files\Microsoft Office\Office\MSACCESS.EXE" "C:\Program Files\Microsoft Office\Office\Samples\Northwind.mdb" /user

 On the second page, type Northwind 2000, and then click Finish. Double-click the new shortcut. Note that the Name box in the Logon dialog box is blank.

NOTE: Although there are Application Programming Interface (API) calls that can be made to the Windows registry for performing such tasks as opening a registry key, reading the key's value, and modifying its value, the timing at which this is done within an Access database causes the results of the API calls to be unsuccessful. The API calls are unsuccessful for two reasons:
 * The API code within the database cannot be run until you have successfully opened the database.
 * Access updates the Last User registry key immediately at the point at which Access closes (after all database code has finished running, including API code).

<div class="references_section">