When you run a macro that calls a VBA function in a Microsoft Access 2007 database, you receive the following error message Action Failed Error Number: 2950. 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. There are few methods to solve this error:
First Method: Move the database to a trusted location and determine trusted locations to which you can move the database. To do this, follow these steps:
1. Click the File Button as shown in Fig 1.1 and then click Access Options.
Fig:-1.1
2. Click Trust Center, and then click Trust Center Settings under Microsoft Office Access Trust Center as shown in Fig 1.2.
Fig:-1.2
3. Click Trusted Locations, and then use one of the following procedures as shown in Fig 1.3.
Fig:-1.3
We can add a new trusted location otherwise we can click Add new location, and then specify the path of the location that you want to add as shown in Fig 1.4.
Fig:-1.4
4. Move the Access 2007 database to the trusted location that you want.
Second Method: Enable the database for the current session and 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 on more details as shown in Fig 1.5.
Fig:-1.5
2. In the Microsoft Office Security Options dialog box, click Enable this content as shown in Fig 1.6.
Fig:-1.6
We can use a 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 for the code to run successfully.
1. Create a form with add a text box or label and then type the information that you want to display to the user as shown in Fig 1.7. Save and then close the form
Fig:-1.7
2. Create a macro and add action Open Form and fill the information as shown in Fig 1.8. After creating Macro save it name of AutoExec.
Fig:-1.8
When the database opens, the AutoExec macro starts and then tests the Is Trusted 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.
DISCLAIMER
It is advised that the information provided in the article should not be used for any kind formal or production programming purposes as content of the article may not be complete or well tested. ERP Makers will not be responsible for any kind of damage (monetary, time, personal or any other type) which may take place because of the usage of the content in the article.