S
Sky
I was making a quick and dirty VBA tool to copy some tables into a database,
but it raised some security questions.
I've cut it down to this code example, which simply copies a table from an
external database.
' This still gives a security warning even from a trusted location in Access
2007 SP1 with Nov 2008 hotfix.
Sub TestThis()
DoCmd.TransferDatabase acImport, "Microsoft Access", "Backup.Mdb",
acTable, "MyTable", "MyTable"
End Sub
The code is in a database that is in a trusted location, so it does not have
any warnings when opened. The "Backup.Mdb" is also in the same trusted
location. The above code simply copies a table from the Backup.Mdb. (If the
table already exists, a numeric suffix is added to the name to avoid
overwriting, but that is not the issue here.)
Why do I get a security warning? The warning comes on the line with
DoCmd.TransferDatabase.
Just in case, I made sure that the SandBoxMode is disabled in the registry,
both for Access 2003 Jet4 and for Access 2007. I'm not sure which entry is
used when Access 2007 opens an Access 2003-compatible .Mdb Jet4 database
file. I have tried setting SandBoxMode to 2, and even to 0, for both
locations at the same time:
Root: HKCU; SubKey: Software\Microsoft\Jet\4.0\Engines; ValueType: dword;
ValueName: SandboxMode; ValueData: 2
Root: HKCU; SubKey: Software\Microsoft\Office\12.0\Access Connectivity
Engine\Engines; ValueType: dword; ValueName: SandboxMode; ValueData: 2
Again, I have also put both databases in the same trusted location.
The only thing that skips the security warning is to enable all macros
globally, using:
Root: HKCU; Subkey: "Software\Microsoft\Office\12.0\Access\Security";
ValueType: dword; ValueName: "VBAWarnings"; ValueData: 1
Turning off warnings globally seems drastic for this. I thought that a
trusted location was supposed to solve this. Am I doing something wrong?
- Steve
but it raised some security questions.
I've cut it down to this code example, which simply copies a table from an
external database.
' This still gives a security warning even from a trusted location in Access
2007 SP1 with Nov 2008 hotfix.
Sub TestThis()
DoCmd.TransferDatabase acImport, "Microsoft Access", "Backup.Mdb",
acTable, "MyTable", "MyTable"
End Sub
The code is in a database that is in a trusted location, so it does not have
any warnings when opened. The "Backup.Mdb" is also in the same trusted
location. The above code simply copies a table from the Backup.Mdb. (If the
table already exists, a numeric suffix is added to the name to avoid
overwriting, but that is not the issue here.)
Why do I get a security warning? The warning comes on the line with
DoCmd.TransferDatabase.
Just in case, I made sure that the SandBoxMode is disabled in the registry,
both for Access 2003 Jet4 and for Access 2007. I'm not sure which entry is
used when Access 2007 opens an Access 2003-compatible .Mdb Jet4 database
file. I have tried setting SandBoxMode to 2, and even to 0, for both
locations at the same time:
Root: HKCU; SubKey: Software\Microsoft\Jet\4.0\Engines; ValueType: dword;
ValueName: SandboxMode; ValueData: 2
Root: HKCU; SubKey: Software\Microsoft\Office\12.0\Access Connectivity
Engine\Engines; ValueType: dword; ValueName: SandboxMode; ValueData: 2
Again, I have also put both databases in the same trusted location.
The only thing that skips the security warning is to enable all macros
globally, using:
Root: HKCU; Subkey: "Software\Microsoft\Office\12.0\Access\Security";
ValueType: dword; ValueName: "VBAWarnings"; ValueData: 1
Turning off warnings globally seems drastic for this. I thought that a
trusted location was supposed to solve this. Am I doing something wrong?
- Steve