Microsoft Office Online
Sign in to My Office Online (What's this?) | Sign in

 
 
Microsoft Office Access
Search
Search
 
Icon: Flag: (c) Microsoft
Get up to speed
 
 
 
Warning: You are viewing this page with an unsupported Web browser. This Web site works best with Microsoft Internet Explorer 6.0 or later, Firefox 1.5, or Netscape Navigator 8.0 or later. Learn more about supported browsers.

Troubleshoot macro security level and warnings
 

To better understand the security features and warnings, and for step-by-step information on preventing the security warnings from appearing each time you open a file, see Frequently asked questions about Access security warnings.

Restricted Access

ShowI can't change the macro security level

Your network administrator might have enforced a security level for your workgroup or corporation to ensure that you use only macros that have been determined to be virus-free. For more information, see your network administrator.

ShowThe Trust access to Visual Basic Project setting in the Security dialog box is unavailable

The Trust access to Visual Basic Project setting is not available in Access. You cannot block programmatic access to the Visual Basic Project.

Macro Warnings

ShowI'm told that my database can't be opened because Access security settings restrict access to the file

You may receive this message for one of the following reasons:

ShowI don't want to be warned about any macros

The only way to avoid macro warnings when you open a database in medium or high security is by ensuring that the database has a valid digital signature, and then adding that signature to your list of trusted sources.

If the macros are already signed and if you are willing to trust all macros signed with that certificate, add the signer to your list of trusted sources. This will stop macro warnings when your Security setting is set to High or Medium.

Note  The presence of a certificate does not guarantee that a macro is safe. Always review the details of the certificate—for example, look at the Issued to and Issued by fields to determine whether you trust its publisher, and look at the Valid from field to determine if the certificate is current.

A less secure option is to change the security level to Low. When your macro security level is set to Low, Microsoft Access will not provide warnings about macros. To reduce your risk of getting a macro virus infection on your computer, run specialized antivirus software that is up to date and that can check files and add-ins for macro viruses, and use macros only from trusted sources.

ShowI keep getting a warning about macros

Important  The only way to avoid macro warnings when you open a database in medium or high security is by ensuring that the database has a valid digital signature, and then adding that signature to your list of trusted sources.

ShowI get a warning about my database not matching the digital signature

Under medium or high security, Access will not open a database if it does not match the signature. A database might not match its signature due to one of the following reasons:
  • Database has been modified by a virus or a malicious hacker.   If you are concerned that the database might have been modified by a virus or a malicious hacker, you should not attempt to open the database. Instead, restore a backup copy of the database.
  • Database has been modified programmatically   If you use DAO to create or modify an action query, or any part of the database that is included in the digital signature, then you need to manually re-sign the database.

    Manually re-sign the database  

    1. On the Tools menu, point to Macros, and click Security. If you do not see the Macro menu item under the Tools menu, or the Security menu item under the Macro menu, click the arrows at the bottom of a drop-down menu to display the hidden menu items.

      Tip  If you want to see all menu items by default, on the Tools menu, click Customize, click the Options tab, and select the Always show full menus check box.

      ShowI still can't see the Security command under the Macro menu

      1. On the Tools menu, click Customize, and then click the Commands tab.
      2. Click Rearrange Commands, select Menu Bar, and in the Menu Bar box, click Tools | Macro.
      3. In the Controls section, click Add.

        The Add command dialog box will appear.

      4. In the Categories box, click Tools, and then in the Commands box, click Security.

        The Security command will appear in the Controls box.

      5. Use the Move Up and Move Down buttons to position the Security command where you want.

        If you'd like to position the Security command in its own group (between horizontal lines), with Security selected, click Modify Selection and click Begin a Group. Select the menu item below the Security command, and repeat.

      6. Click Close twice.
    2. In the Security dialog box, select Low.

      Warning  If there is any possibility of the database having been modified by a virus or a malicious hacker, you should not attempt to open the database. Instead, you should restore a backup copy of the database.

    3. Open the database.
    4. Remove the signature. For more information on how to remove a signature, see the Help topic Remove a digital signature.
    5. Add the signature to the database. For more information on how to add a signature, see the Help topic Add a digital signature to a VBA project.
    6. Close the database.
    7. In the Security dialog box, select Medium or High.

    To avoid modifying a database programmatically, try one of the following:

    • Do not make changes to forms and reports in Design view, and do not save your changes.
    • Instead of creating new forms or reports, create form and report templates. Modify the templates, but don't save changes.
    • Instead of modifying or creating queries, try the following:
      • Embed the entire query in the code and execute it directly. For example,

        CurrentDB.Execute “DELETE * FROM tblTemp WHERE ID=” & iMyID

      You can also create a parameterized query. The parameters can be passed to the query by using the Parameters property of the QueryDef before QueryDef.Execute is called.

  • Database has been modified by a previous version of Access   When a database is signed, previous versions of Access cannot modify VBA code. However, a user can modify macros, action queries, and ActiveX controls on forms and reports using a previous version of Access.

    To solve this problem, you need to manually re-sign the database. For more information on how to do this, see the section Data has been modified programmatically in this topic.

  • Access closed before it could re-sign the database   This could happen in two situations:
    • An error occurred that prevented Access from re-signing the database before closing.
    • You changed ActiveX control properties, switched to browse view without saving changes, and attempted to close Access. In this situation, even if you click Yes when prompted to save changes, Access will not re-sign the database.

      To solve this problem, you need to manually re-sign the database. For more information on how to do this, see the section "Data has been modified programmatically," in this topic.

  • A form or report in the database that contains an ActiveX control was exported to XML or ASP format   When a form or report is exported to either XML or ASP format, the form or report is opened in design view, exported, and then saved. The form or report is saved, even though no changes were made to it. If the form or report contains an ActiveX control, Access will attempt to re-sign the database. If the certificate that was used to sign the database is not installed, Access will remove the signature from the database, display a message, and leave the database in unsigned state.

    Since ActiveX controls are ignored when exporting to XML or ASP format, the recommended workaround is to create a form or report similar to the one that you want to export, but without the ActiveX control, and export the new object.

    Note  Exporting to other file formats does not cause this problem.

ShowI get a warning each time I open a file that is in Access 97 or earlier format

You can add signatures to a file in Access 2000 or later file format. Files in Access 97 or earlier file formats will cause Access to display the security warning each time you open a file.

ShowThe security warning interrupts the execution of automation scripts

Each time you open an unsigned database under medium or high security, you will be prompted with a security warning. This can cause problems when you are using automation to open a database in a process that is not being monitored by a user, because the security warning requires user interaction. You can use the AutomationSecurity property to suppress the warning from occurring when opening a database using automation. The following is an example of a Visual Basic script that uses the AutomationSecurity property to suppress the security warning when opening a database.

Caution  This technique should be used only if the database is in a location that cannot be modified by a virus or any unauthorized person. Opening databases that are on public network locations or shared directories on the local machine could be dangerous.

Const cDatabaseToOpen = "C:\<FileToOpen>.mdb"

On Error Resume Next
Dim AcApp 
Set AcApp = CreateObject("Access.Application")
If Val(AcApp.Version) >= 11  Then
	AcApp.AutomationSecurity = 1 ' msoAutomationSecurityLow
End If
AcApp.Visible = True
AcApp.OpenCurrentDatabase cDatabaseToOpen 
If AcApp.CurrentProject.FullName <> "" Then 
	AcApp.UserControl = True
Else
	AcApp.Quit
	MsgBox "Failed to open '" & cDatabaseToOpen  & "'."
End If

Simply double-click the VBS file to open your database.

advertisement