Friday, February 15, 2013

Access Developer Extensions: Specify data type for Additional Registry Settings, Value parameter

I'm deploying my first MS Access 2007 runtime database using the Access Developer Extensions add-in, but code won't run on target machines because the Trust Center->Macro Setting is "Disable All Macros".  I need "Enable All Macros" or my database VBA code won't run, and there is no way to set this using Access in a runtime file, OMG, what am I going to do?!?

Yeah, tweak the registry, and ADE makes this easy with the Additional Registry Keys section on page three of the setup wizard.  Here are the keys I want to set ...
HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Access\Security [VBAWarnings] = dword:000001
... and ...
HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Access\Security\Trusted Locations [AllowNetworkLocations] = dword:000001
... but where I got stuck is how to specify the data type of the Value parameter.  The registry needs a REG_DWORD value or it has no effect.  So after much googling I finally found the solution here at UtterAccess posted by Mr. Albert Kallal, who refers us back here to a useful Microsoft page.

And since this is the kind of info I'll use infrequently enough to forget, here's the secret.
Prefix #x
The value is interpreted and stored as a hexadecimal value

Prefix #%
The value is interpreted and stored as an expandable string

Prefix #
The value is interpreted and stored as an integer (REG_DWORD)
But it's a secret, OK.  So don't tell anybody.