Microsoft KB Archive/321905

= ACC2000: Database Password Prompt Appears After You Open a Database Using a Hyperlink or Visual Basic for Applications (VBA) Code =

Article ID: 321905

Article Last Modified on 6/25/2004

-

APPLIES TO


 * Microsoft Access 2000 Standard Edition

-



This article was previously published under Q321905



Moderate: Requires basic macro, coding, and interoperability skills.

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

For a Microsoft Access 2002 version of this article, see 322860.



SYMPTOMS
When you open a database, a prompt appears for a database password, even though you may not have set a database password for the database.



CAUSE
You previously opened the database in one of the following ways:
 * You used a hyperlink from another Microsoft Office program to open the database.

-or-
 * You used Microsoft Visual Basic for Applications (VBA) automation code to open the database.

While the database was open, you compacted it, either manually or by setting the Compact on Close attribute of the database. While you were compacting the database, a database password was unexpectedly set on the database.



RESOLUTION
After a database password is set in this way, you cannot access the database by opening it directly in Microsoft Access. To recover the information from the database, you must open the database by using either a hyperlink or VBA automation code. Then you must export each of the objects into a new database.

Opening the Database Using a Hyperlink

 * 1) Create a new, blank database in Access.
 * 2) Close the database.
 * 3) Open Microsoft Word.
 * 4) On the Insert menu, click Hyperlink.
 * 5) Locate the database file that you cannot open directly in Access, and then select it.
 * 6) While holding down the CTRL key, click the hyperlink that you created in step 4.
 * 7) When the database opens, select an object that you want to export.
 * 8) On the File menu, click Export.
 * 9) Locate the database that you created in step 1, and then click Export.
 * 10) Repeat steps 7 through 9 for each object that you want to export.

Opening the Database Using VBA Automation Code
 Create a new, blank database in Access. Close the database. Open the Microsoft Visual Basic Editor in any Office program. On the Tools menu, click References. Click to select the Microsoft Access 9.0 Object Library, and then click OK. On the Insert menu, click Module.</li>  Type or paste the following code into the module. Dim oAcc As Access.Application

Sub OpenAccessFile

Set oAcc = GetObject(&quot;C:\MyPath\MyDatabase.mdb&quot;) ' Replace &quot;C:\MyPath\MyDatabase.mdb&quot; with the path to your database.

oAcc.Visible = True

End Sub </li> Run the procedure.</li> When the database opens, select an object that you want to export.</li> On the File menu, click Export.</li> Locate the database that you created in step 1, and then click Export.</li> Repeat steps 9 through 11 for each object that you want to export.</li></ol>

<div class="status_section">

STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

<div class="references_section">