Avoid runnign the autoexec macro

  • Thread starter Thread starter Rodrigo
  • Start date Start date
R

Rodrigo

How to I stop the autoexec macro from running when openning a database
trough automation?

Private Function OpenThisDB()
On Error Resume Next
Dim oAcc As Access.Application
Dim oDB As Database

Set oAcc = New Access.Application
Set oDB = oAcc.DBEngine.OpenDatabase("c:\tmp.mdb", False, False)
oAcc.OpenCurrentDatabase "c:\tmp.mdb", False
' how to avoid the AutoExec macro
' and the form in on the database startup properties
' from start running here
oAcc.CloseCurrentDatabase
Set oDB = Nothing
Set oAcc = Nothing
End Function

Thanks,

Rodrigo.
 
Great!

How about the form in the startup properties. I specially would like to to
this without having to change the database properties before opening the
database (to stop it from opening that form). Also most of the databases
that I am automating have the AllowBypassKey set to false, any way to avoid
this withtout changing it to true first?. Though if it's not posible, I can
change them (both the form and the AllowBypassKey), open the database and
then change them back.

Thanks,

Rodrigo.
 
Back
Top