N
Nando
Hi everyone! I need to open an ADP project through automation (I know how to
do that). However, when I do it all the scripting stuff starts executing
(startup forms, autoexec macro..). I would like to bypass these methods and
open the adp file to do my stuff. What I would like is a way I can set the
"AllowBypassKey" property, so I later can quietly open the file through
automation without all that scripting executing . I was successful doing it
for a standard MDB file. I used the code below to set the property to False,
and then use the automation to open the file again and do what I actually
want to do. However, when I run this code with an ADP project it comes up
with a runtime error 3343 "Unrecognized database format." The ADP format
seems to be incompatible with DAO. So how do I set the "AllowBypassKey"
property of an ADP file without having to open the database directly or
automated? I need to avoid the auto-scripting when opening the file through
automation.
Call SetDAOProperty("C:\mydatabase.adp", "AllowByPassKey", dbBoolean, False)
Public Function SetDAOProperty(strDBFilename As String, strPropertyName As
String, _
PropType As DAO.DataTypeEnum, vPropVal As
Variant )
Dim db As DAO.Database
Dim prop As DAO.Property
Set db = DAO.OpenDatabase(strDBFilename)
On Error Resume Next
db.Properties.Delete strPropertyName
Set prop = db.CreateProperty(strPropertyName, PropType, vPropVal, True)
db.Properties.Append prop
Set prop = Nothing
db.Close
Set db = Nothing
End Function
do that). However, when I do it all the scripting stuff starts executing
(startup forms, autoexec macro..). I would like to bypass these methods and
open the adp file to do my stuff. What I would like is a way I can set the
"AllowBypassKey" property, so I later can quietly open the file through
automation without all that scripting executing . I was successful doing it
for a standard MDB file. I used the code below to set the property to False,
and then use the automation to open the file again and do what I actually
want to do. However, when I run this code with an ADP project it comes up
with a runtime error 3343 "Unrecognized database format." The ADP format
seems to be incompatible with DAO. So how do I set the "AllowBypassKey"
property of an ADP file without having to open the database directly or
automated? I need to avoid the auto-scripting when opening the file through
automation.
Call SetDAOProperty("C:\mydatabase.adp", "AllowByPassKey", dbBoolean, False)
Public Function SetDAOProperty(strDBFilename As String, strPropertyName As
String, _
PropType As DAO.DataTypeEnum, vPropVal As
Variant )
Dim db As DAO.Database
Dim prop As DAO.Property
Set db = DAO.OpenDatabase(strDBFilename)
On Error Resume Next
db.Properties.Delete strPropertyName
Set prop = db.CreateProperty(strPropertyName, PropType, vPropVal, True)
db.Properties.Append prop
Set prop = Nothing
db.Close
Set db = Nothing
End Function