G
Guest
I have a database that contains an autoexec macro. Essentially it takes the
results of a query and appends them into a table. I run this manually once a
week because the database I am updating is secured with an mdw file so I have
to sign in. Is there a way using VBA that I can open this database passing in
my user id and password fields so that this can be automated. I've searched
through the boards and found out how to create a connection (works great) but
not actually open a secured db.
I have tried this but I get and error saying that it is not a valid account
or password.
Private Sub MyTest()
Dim DBdaAgg As Database
Dim wrkSec As Workspace
DBEngine.SystemDB = "I:\Resource.MDW"
Set wrkSec = DBEngine.CreateWorkspace("master", "somecut", dbUseJet)
Set DBdaAgg = wrkSec.OpenDatabase("C:\Documents and
Settings\E09461\Desktop\Temp\SYSTTimesheet.mdb;")
DBdaAgg.Close
wrkSec.Close
Set DBdaAgg = Nothing
Set wrkSec = Nothing
End Sub
As always thanks in advance for any help you can give me.
m
results of a query and appends them into a table. I run this manually once a
week because the database I am updating is secured with an mdw file so I have
to sign in. Is there a way using VBA that I can open this database passing in
my user id and password fields so that this can be automated. I've searched
through the boards and found out how to create a connection (works great) but
not actually open a secured db.
I have tried this but I get and error saying that it is not a valid account
or password.
Private Sub MyTest()
Dim DBdaAgg As Database
Dim wrkSec As Workspace
DBEngine.SystemDB = "I:\Resource.MDW"
Set wrkSec = DBEngine.CreateWorkspace("master", "somecut", dbUseJet)
Set DBdaAgg = wrkSec.OpenDatabase("C:\Documents and
Settings\E09461\Desktop\Temp\SYSTTimesheet.mdb;")
DBdaAgg.Close
wrkSec.Close
Set DBdaAgg = Nothing
Set wrkSec = Nothing
End Sub
As always thanks in advance for any help you can give me.
m