Unsafe
Expressions - Macro Security In Access 2003
Author:
Garry Robinson from GR-FX, November 2003
THIS PAGE IS IN DEVELOPMENT BUT MAY HELP SOMEONE
To Do - Access 2000 Developers Upwards
Developers will need to download the following service pack. This will change
the version of Jet 4 that you are using with Access 2000, 2002, 2003. You should
start explaining to you customers that they should upgrade if they intend
installing Access 2003 before Mid 2004. Otherwise, they encounter more issues
than they need to. Find out more and download from the following
Microsoft Knowledge Base
Article - 829558
Otherwise head to windowsupdate.microsoft.com
Scan for updates
Pick the operating system list. (It is a non essential download)
Find Update for Jet 4.0 Service Pack 8 (KB829558) and click Add
Click Review and Install updates
Click Install Now
When you have finished, the file c:\windows\system32\msjet40.dll should have
a version property value of 4.0.8015.0
When you install Access 2003 on a computer, it is very likely
that you are going to enocunter the following screen. the following page shows
you what happens when you open the Office 2003 Northwind database that came
straight from the Office CD Rom. Why you cannot trust this database is beyond me
and why the database came without being signed by Microsoft is bissare. Anyway
it makes an interesting technology read.

Figure 1
If you read this form, you will probably guess that you need
to click either Yes or No but what for is hard to work out. If you first click
the Hide Help button, it is easier to work out that you are meant to confirm
whether you want to open the database or not. If you click No, it means that you
are not ready for these unsafe expresssions, whatever they are and you don;t
want . If you are to follow the links to unsafe expressions, you need to work
hard to find some useful help. The page that this help tries to direct you is
here. The Open in Help window help has a link that leads to a dead end, so don't
bother with that one.
Its Time To Regroup
At this stage I suggest that you click No and have a read
about a few topics by going to this page.
Read about Microsoft Jet Expression Service sandbox mode
Charging On
I know, you charged on by clicking the Yes button in Figure 1
and you then were greeted with the next wonderfully inviting screen. Imagine if
you were a user and they were greeted by this the first time that they opened
your database. Image worse still if they were greeted by this everytime that
they opened your database. Anyway in this instance, the More Info button brings
up some quite useful help in the help window so you may want to read all that
first.

Figure 2 - Security Warning Opening a Database
To continue on, you must Click the Open button. That then
opens the Northwind database and all seems pretty good. You then go to open the
same database again after making no changes to the code and guess what, you run
into all the same prompts as shown above. Cleary you would never want your user
to go through all this nonsense, well at least not without an explanation.
Turning Off Your Macro Security - Setting To Low Level
Havign been through this exercise before with the beta
versions of Access 2003, I then went to the menu Tools ~ Macros to find the
Security. The only thing is that it wasn't there this time. Maybe this is
becuase I haven;t installed Jet 4 Service Pack 8 but I am not sure. So I
searched the help and guess what, adding the Security option to the macro menu
was very long winded. The instructions from the help file follow and you can see
the whole thing if click on the image in Figure 3. This image takes the whole
screen to fit all the cascading windows on the page.
Figure 3 -
I still can't see the Security command under the Macro menu
On the Tools menu, click Customize, and then click the Commands tab.
Click Rearrange Commands, select Menu Bar, and in the Menu Bar box, click Tools
| Macro.
In the Controls section, click Add.
The Add command dialog box will appear.
In the Categories box, click Tools, and then in the Commands box, click
Security.
The Security command will appear in the Controls box.
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.
Click Close twice.
Turning Off The Macro Security Warnings
Now that you hopefully have the macro security menu option
visible, you can turn off the macro security as follows
Go to the menu Tools ~ Macros ~ Security and the dialog box
displayed in Figure 4 will be displayed. Now select the Low Security Level and
all the prompts will disapear. Possibly though a macro virus will be run from
your database.

Figure 4 - Macro Security Levels.
What Happens When You Select Low Security
When you select the Low security setting, you would think that
the complications for you (and your users) would be over. Unfortunately not,
there is more. There is the ambiguos question about unsafe expressions. The
answer to this lies not in choosing Yes or No but in testing your application to
see if it has any unsafe expressions or not. If it doesn't, then you can pretend
to be a security expert and advise your client that it is OK to use your
database whilst selecting No to this prompt. What this prompt is saying is that
if you Click Yes, Sandbox mode will be turned off and of you click no it will be
turned on.

Figure 5
Problems With Wizards
If You Leave The Sandbox On (answer No to msgbox
in Figure 5) And Are Running Jet 4.7, you will encounter an error like that
shown in Figure 6.

Figure 6 - Sandbox mode error with Jet 4.7.
Now if you also happen to be running Access 2002 on your computer,
you will suddenly run into the following error when running wizards

Figure 7 - Access 2002 Error caused by Sandbox mode.
If you are using Access 2002, you can simulate this by searching
the registry for SandboxMode and making the value of the key
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Jet\4.0\Engines\SandboxMode =
3
Rememember to reset it back to 2 when you have finished your
testing.
Macro Security In Access 2003
http://office.microsoft.com/assistance/preview.aspx?AssetID=HP010446071033&CTT=4&Origin=CH010411431033
Click on the
button for the next
help page in this Access Loop.