Avatar of Phve_364
Phve_364
 asked on

VBSCRIPT - Run a macro from a securised Access Database

I'm writing a VBScript that will run a macro from a secured Access database :

Database : c:\afac\test.mdb
SystemDB (not secured) : c:\afac\system.mwd
SystemDB (secured) : c:\afac\NewSystem.mdw (user = test - password = PwdTest)

Example 1 : my database is not secure -> no problem :

Dim oAccess
Dim oWorkspace
Set oAccess = CreateObject("Access.Application")
oAccess.SetDefaultWorkgroupFile("c:\afac\System.mdw")
oAccess.OpenCurrentDatabase "c:\afac\test.mdb"
oAccess.DoCmd.RunMacro "Macro"
oAccess.CloseCurrentDatabase
oAccess.Quit

Example 2 : my database is secure -> problem : How can I say who is the user and what is the password ?

Dim oAccess
Dim oWorkspace
Set oAccess = CreateObject("Access.Application")
oAccess.SetDefaultWorkgroupFile("c:\afac\NewSystem.mdw")
oAccess.OpenCurrentDatabase "c:\afac\test.mdb"  ' -> Microsoft Office Access can't open the database because it is missing, or opened exclusively by another user.
oAccess.DoCmd.RunMacro "Macro"
oAccess.CloseCurrentDatabase
oAccess.Quit

Thanks for your help
Microsoft AccessMicrosoft Development

Avatar of undefined
Last Comment
peter57r

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
peter57r

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23