Windows Scripting Host (WSH): Open an ACCESS Database with User Security

U

ug

Hello ACCESS Freaks,

I want to print ACCESS reports using a scheduled task.

Therefore I set up an executable (AAA.vbs) within Windows
Scripting Host (WSH) commands like:

Dim objAcc
Dim strDBName

Set objAcc = WScript.CreateObject("Access.Application")
strDBName = "Z:\Test\Northwind.mdb"
objAcc.OpenCurrentDatabase strDBName
objAcc.DoCmd.OpenReport "Catlog"
objAcc.Quit

This works properly for a database that is not user
secured.

I'm looking for a command that will open the database
using a workgroup information file (.mdw).
Which parameter do I have to use?

Help is very appreciated, thanks.

ug
 
W

Wayne Morgan

I'm not familiar with WSH, but the DOS command line to do what you're
wanting is

"<path>\Msaccess.exe" "<path>\MyFile.mdb" /User UserName /Pwd Password
/Wrkgrp "<path>\MyFile.mdw"

You can skip defining the workgroup file if it has been set up as the
default on your computer.
 
U

ug

Hi Wayne,

Thanks for your answer but this start up option for access
databases I already know.
It would be a possibility to create a macro printing the
report. This macro can be run with the start option /x
macroname.

BUT -is there anybody that can help me with Windows
Scripting Host (WSH) command/parameter?

All help is very appreciated.

ug
 
S

SA

UG:

You use the WshShell object as in:

Dim WshShell, oExec
Set WshShell = CreateObject("WScript.Shell")

Set oExec = WshShell.Exec("calc")

Do While oExec.Status = 0
WScript.Sleep 100
Loop
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top