Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

Programmatically modifying an action query in an Access database invalidates the digital signature of the Access database


View products that this article applies to.

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

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

↑ Back to the top


Symptoms

In a Microsoft Office Access 2003 database that is digital signed, if you programmatically modify an insert query, an update query, or a delete query by using Microsoft Visual Basic Editor, the digital signature of the database may become invalid when you try to open the database. Subsequently, with the security level set to medium or to high, the Access database may not open, and you may receive the following error message:
The code or macros in this file do not match the digital signature. This mismatch was most likely caused by one of the following:
- The file was modified by a virus.
- The file was modified by an earlier version of Microsoft Access.

Check the file for viruses with an updated virus scanner, and notify the publisher of this file. The current security settings prevent Access from opening this file.

You may also receive the following warning message:

Microsoft Office Access cannot open FullPathToAccessDatabaseFile due to security restrictions.

Either macros are disabled or security settings restrict access to the file because it is not digitally signed.

↑ Back to the top


Workaround

To avoid this problem, do not programmatically modify an action query when your Access database is digitally signed.

To work around the problem that is mentioned in the "Symptoms" section of this article, modify the security level of the Access database to low, and then remove and then add the digital signature to the database. To do this, follow these steps:
  1. Start Microsoft Office Access 2003.
  2. On the Tools menu, point to Macro, and then click Security.
  3. In the Security dialog box, select the Low (not recommended). You are not protected from potentially unsafe macros. Use this setting only if you have virus scanning software installed, or you have checked the safety of all documents you open option, and then click OK.

    Note You may receive an Access warning message that prompts you to confirm the security setting. Click Yes in the warning message to confirm. You may have to close and then reopen Access for the new security setting to take effect.
  4. Open the Access database for which the problem that is mentioned in the "Symptoms" section of this article occurs.
  5. On the Tools menu, point to Macro, and then click Visual Basic Editor.
  6. In the Visual Basic Editor, click Digital Signature on the Tools menu.
  7. In the Digital Signature dialog box, click Remove.
  8. In the Digital Signature dialog box, click Choose.
  9. In the Select Certificate dialog box, click the digital signature that you removed in step 7 in the Select the certificate you want to use list, and then click OK.
  10. In the Digital Signature dialog box, click OK.
  11. On the File menu, click Close and Return to Microsoft Office Access.
  12. In Microsoft Access 2003, point to Macro on the Tools menu, and then click Security.
  13. In the Security dialog box, select the Medium. You can choose whether or not to run potentially unsafe macros option, and then click OK.

    Note You may receive an Access warning message that prompts you to confirm the security setting. Click Yes in the warning message to confirm. You may have to close and then reopen Access for the new security setting to take effect.
  14. Reopen the Access database. You may not notice the error messages that are mentioned in the "Symptoms" section of this article.

↑ Back to the top


More information

Steps to Reproduce the Behavior

Caution If you follow the steps in this example, you modify the sample database Northwind.mdb. You may want to back up the Northwind.mdb file and follow these steps on a copy of the database.
  1. Start Microsoft Office Access 2003.
  2. On the Tools menu, point to Macro, and then click Security.
  3. In the Security dialog box, click to select the Medium. You can choose whether or not to run potentially unsafe macros option, and then click OK.
  4. Open the Northwind.mdb sample Access database.
  5. Create the following query, and then save the query as EmpUpdQuery:
    UPDATE Employees SET FirstName = FirstName
  6. On the Tools menu, point to Macro, and then click Visual Basic Editor.
  7. In the Visual Basic Editor, click Digital Signature on the Tools menu.
  8. In the Digital Signature dialog box, click Choose.
  9. In the Select Certificate dialog box, click a digital signature in the Select the certificate you want to use list, and then click OK.
  10. In the Digital Signature dialog box, click OK.
  11. On the File menu, click Close and Return to Microsoft Office Access.
  12. Close the Northwind.mdb database, and then open it again.

    Note You may notice that the Security Warning message box is displayed. Click Open to open the Northwind.mdb database.
  13. On the Tools menu, point to Macro, and then click Visual Basic Editor.
  14. On the View menu, click Immediate Window.
  15. In the Immediate Window, type the following code, and then press ENTER:
    Application.CurrentDb.QueryDefs("EmpUpdQuery").SQL = "SELECT * FROM Employees;"
  16. On the File menu, click Close and Return to Microsoft Office Access.
  17. Close and then reopen the Northwind.mdb database.

    You may notice the error messages that are mentioned in the "Symptoms" section of this article.

↑ Back to the top


References

For more information about Digital Signatures, click Microsoft Office Access Help on the Help menu, type About digital signatures in the Search for box in the Assistance pane, and then click Start searching to view the topic.

↑ Back to the top


Keywords: kbvba, kbopenfile, kbdatabase, kbdigitalsignatures, kberrmsg, kbmessagebox, kbsecurity, kbvalidation, kbauthentication, kbquery, kbprb, kbprogramming, KB828412

↑ Back to the top

Article Info
Article ID : 828412
Revision : 5
Created on : 7/28/2006
Published on : 7/28/2006
Exists online : False
Views : 281