Starting a database from a Windows Script

D

dch3

I'm developing a script to do some file system-related house cleaning prior
to opening a database. The file task being to start Access and crank up the
database. Obviously, its not working. I've tried...

strLocalFrontEnd = "C:\\Documents and Settings\\All
Users\\Documents\\Trailer Management and Manifest Front End.mdb"

Set WshShell = WScript.CreateObject("WScript.Shell")
wshShell.run strLocalFrontEnd 'Returns error -2147024894
Set wshShell = Nothing

wshShell.run "msaccess.exe" 'Successfully opens the database

wshShell.run "msaccess.exe " & strLocalFrontEnd 'Starts access, but views
the path to the front end as being comprised of command line switches
 
A

Albert D. Kallal

I explai here:

http://www.members.shaw.ca/AlbertKallal//BatchJobs/Index.html

A windows script (vbs( looks like:


dim accessApp
set accessApp = createObject("Access.Application")
accessApp.OpenCurrentDataBase("C:\some path name\someMdb.mdb")

accessApp.Run "TimeUpDate"
accessApp.Quit
set accessApp = nothing

The above script will launch ms-access, and then run a sub called TimeUpDate
in a standard code module.

What your code does in the standard sub called TimeUpdate is up to you. You
can print reports, or do whatever you want.
 
B

bcap

strLocalFrontEnd = """C:\Documents and Settings\All Users\Documents\Trailer
Management and Manifest Front End.mdb"""

Set WshShell = WScript.CreateObject("WScript.Shell")
wshShell.run strLocalFrontEnd 'Returns error -2147024894
Set wshShell = Nothing

wshShell.run "msaccess.exe " & strLocalFrontEnd
 

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