Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

vbs batch program needs to bypass startup form 1

Status
Not open for further replies.

BitZero

Programmer
Mar 11, 2008
100
US
I have an Access 2003 database, and a little vbs program that runs every night to refresh a table from the mainframe. The vbs program looks like this:

Code:
dim objAccess
set objAccess = createObject("Access.Application")
objAccess.OpenCurrentDataBase "c:\myDir\myProg.mdb"
objAccess.Run "Nightly_Update"
objAccess.Quit
set objAccess = nothing

The problem is when OpenCurrentDataBase starts the program, the Startup form opens. The vbs program is run by the windows scheduler on a server in batch mode. How can I disable the startup form if running in batch, but open the startup form when not in batch?
 
You might try running Access with command line arguments (ref:
At an opportune time try running your script by typing this into a command line (with appropriate edits for your system):
Code:
"Your\Path\to\access\msaccess.exe" "c:\My Folder\My Database.accdb" /x "Nightly_Update"

If that works to your satisfaction, you can change your VBScript to something like:
Code:
option explicit

Dim WshShell

Set WshShell = CreateObject("WScript.Shell")
'window option '4' specifies the most recently used size/position
WshShell.Run "Your\Path\to\access\msaccess.exe" "c:\My Folder\My Database.accdb" /x "Nightly_Update", 4, False
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top