You need to do it from *outside* your MDB, as it takes effect before
anything *in* the MDB can run.
The code below is from a VB.NET console app with a reference added to the
Microsoft Access 11 Object Library, but presumably the same thing could be
done in VB6, or in VBA in Word or Excel. The code opens a new instance of
Access and opens an unsigned MDB, bypassing the security warning by
programmatically setting the 'macro' security level to low.
A couple of caveats ...
I've only played with this on my own system - I have not tested it in the
'real world'.
The AutomationSecurity property is new, and only
briefly documented, in Access 2003, but I understand it has been around for
some time now in Word and Excel, and I found everything I needed to know
about it in the Excel help file.
The Excel help file recommends setting the property back to its previous
value after opening the document. The example below doesn't do this, but it
would certainly be a good idea to do it in a real-world situation.
Module Module1
Sub Main()
Dim app As New Microsoft.Office.Interop.Access.Application
app.AutomationSecurity =
Microsoft.Office.Core.MsoAutomationSecurity.msoAutomationSecurityLow
app.OpenCurrentDatabase("C:\SomeFolder\Some.mdb", True)
app.Visible = True
End Sub
End Module