MicrosoftВ® Office Access(TM) 2007 Inside Out (Microsoft Office Access Inside Out)
Earlier in this chapter we mentioned that Access 2007 has trusted and not trusted macro actions. As you might recall from Chapter 2, “Exploring the New Look of Access 2007,” the Trust Center settings in the Access Options dialog box control whether Access disables certain content in your database. If your database is not trusted, Access might silently disable any potentially malicious macros or VBA code depending upon the Trust Center settings you enabled or disabled. So what exactly is a malicious macro? In Microsoft’s terms, a malicious macro runs an action that could potentially do harm to your computer or files, such as deleting a file.
Access 2007 separates macro actions into two categories-those that will run in any database, even in a database that is not trusted (trusted macros), and those that can run only in a database that is trusted (not trusted macros). Note that if you select Enable All Macros in the Trust Center Macro Settings section (not recommend by Microsoft), Access treats all macro actions as trusted even when the database is not trusted.
Note | If you are in a corporate network environment, you should check with your Information Technology department to determine whether your company has established guidelines concerning enabling content in Access databases. |
Access 2007 recognizes 32 macro actions as potentially unsafe to run in a database that is not trusted. Seven of the actions are not trusted only when you select certain arguments. Table 18–1 lists the macro actions that Access will run only when the database is trusted. The Comments column lists special cases dependent on the arguments you choose or an alternative trusted method you can use.
Action | Comments |
---|---|
Close | Setting the Save argument to Prompt is trusted. |
CopyDatabaseFile | |
CopyObject | |
DeleteObject | |
Echo | |
OpenDataAccessPage | |
OpenDiagram | |
OpenForm | Setting the View argument to Design or Layout is not trusted. |
OpenFunction | |
OpenModule | |
OpenQuery | Setting the View argument to Design is not trusted. |
OpenReport | Setting the View argument to Design or Layout is not trusted. |
OpenStoredProcedure | |
OpenTable | Setting the View argument to Design is not trusted. |
OpenView | |
Printout | |
Quit | Setting the Options argument to Prompt is trusted. |
Rename | |
RunApp | |
RunCommand | Commands that affect objects in Design or Layout view are not trusted. |
RunSavedImportExport | |
RunSQL | |
Save | |
SendKeys | |
SetValue | Use the trusted SetProperty action instead of SetValue to change the Enabled, Visible, Locked, Left, Top, Width, Height, Fore Color, Back Color, or Caption properties of forms, reports, or controls. |
SetWarnings | |
ShowToolbar | |
TransferDatabase | |
TransferSharePointList | |
TransferSpreadsheet | |
TranferSQLDatabase | |
TransferText |
In the Wedding List Macro sample database, you can find a macro that shows you all the macro actions that are not trusted. Open the mcrXmplNotTrustedActions macro in Design view to see all 32 macro actions that are not trusted, as shown in Figure 18–27.
Категории