Microsoft KB Archive/931407

From BetaArchive Wiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Article ID: 931407

Article Last Modified on 10/15/2007



APPLIES TO

  • Microsoft Office Access 2007



SYMPTOMS

When you run a macro that calls a Microsoft Visual Basic for Applications (VBA) function in a Microsoft Office Access 2007 database, you receive the following error message:

Action Failed

Macro Name:
MacroName

Condition:
Condition

Macro Name:
RunCode

Arguments:
Arguments

Error Number:
2950

CAUSE

This issue occurs if the database is not trusted by Access 2007. By default, Access 2007 opens databases that are not trusted in Disabled mode. In Disabled mode, executable content is disabled.

RESOLUTION

If you trust the author of the Access 2007 database, and if you want to enable the database, use one of the following methods.

Method 1: Enable the database for the current session

When you use this method, Access 2007 enables the database until you close the database. To enable the database for the current session, follow these steps:

  1. On the Message Bar, click Options.
  2. In the Microsoft Office Security Options dialog box, click Enable this content, and then click OK.

Note You must repeat these steps every time that you open the database.

Method 2: Move the database to a trusted location

To do this, follow these steps:

  1. Determine trusted locations to which you can move the database. To do this, follow these steps:
    1. Click the Microsoft Office Button, and then click Access Options.
    2. Click Trust Center, and then click Trust Center Settings under Microsoft Office Access Trust Center.
    3. Click Trusted Locations, and then use one of the following procedures:
      • Note the paths of the trusted locations that are listed.
      • Add a new trusted location. To do this, click Add new location, and then specify the path of the location that you want to add.
  2. Move the Access 2007 database to the trusted location that you want.


MORE INFORMATION

You can use an AutoExec macro to test whether a database is trusted when you open the database. Additionally, the macro can open a form that displays a customized message to users if the database is not trusted. This message lets users know that the database must be enabled or trusted for the code to run successfully.

To create the AutoExec macro and the form, follow these steps:

  1. Create a new form in Design view.
  2. Add a text box or a label to the form, and then type the information that you want to display to the user.
  3. Save and then close the form.
  4. Create a macro, and then name the macro AutoExec.
  5. Show the Conditions column.
  6. Type the following line in the Conditions column:

    CurrentProject.IsTrusted = False

  7. In the Actions column, click OpenForm.
  8. In the Form Name box under Action Arguments, click the form that you created in step 1.
  9. Save and then close the macro.

When the database opens, the AutoExec macro starts and then tests the IsTrusted condition. If the database is not trusted by Access 2007, the macro opens the form that you specified in the "OpenForm" action of the macro.

REFERENCES

For more information, see the Help files in Access 2007. To do this, click Microsoft Office Access Help, type how database objects behave when trusted and untrusted in the Type words to search for box, and then click Search.


Additional query words: ac2007 acc2007 access2007

Keywords: kberrmsg kbtshoot kbprb kbexpertiseinter KB931407