I am trying to script access to an Access database for use on the command line. The Access database is secured with a workgroup file.
Dim oApp, sWGF,myWS
Set sApp = CreateObject("Access.Application")
set sWGF = "C:\Users\Alan\Documents\Secured.mdw"
oApp.DBEngine.SystemDb = sWGF
WScript.echo "Workgroup " & sWGF
WScript.echo "SystemDb " & oApp.DBEngine.SystemDb
Set myWS = oApp.DBEngine.CreateWorkspace("New","Name","Password")
This code outputs the Secured.mdw filename for the workgroup, but the default System.mdw filename for the SystemDB as the output from the two WScript.echo commands. It also fails to create the workspace saying the Name and Password are wrong (although they ARE correct for the Secured.mdw file)
There are lots of references elsewhere on the net that say you can only do this as the first thing inside an application, but that IS what I am doing.
I am not sure what I am doing wrong. Any ideas