I am totally new to vbScript.

I have an Access application that I want to kick-off using VBscript, but I
have not been able to figure out how to do it. I would like the script to
open the application in hidden mode, then execute the Autoexec macro that is
in the app.

Can anyone suggest a format for this operation? How about a good text for
someone that has been programming in VBA (mostly Access, but some Excel) for
about 7 years.

Re: Start Access Application from vbScript by Miyahn

Miyahn
Wed Nov 30 08:45:54 CST 2005

"Dale Fye" wrote in message news:579B6AD1-C226-461A-8706-F231E7EE9D8F@microsoft.com
> I am totally new to vbScript.
>
> I have an Access application that I want to kick-off using VBscript, but I
> have not been able to figure out how to do it. I would like the script to
> open the application in hidden mode, then execute the Autoexec macro that is
> in the app.

Try this.

Const Target = "D:\Data\db1.mdb"
With CreateObject("WScript.Shell")
.Run Target, 0
End With
WScript.Sleep 100 ' a charm

(Different from Excel)Access terminates when the parent process terminates.
Compare with this.

Const Target = "D:\Data\db1.mdb"
With CreateObject("Access.Application")
.OpenCurrentDatabase Target
End With
WScript.Sleep 100


Re: Start Access Application from vbScript by dale

dale
Wed Dec 07 10:02:02 CST 2005

Miyahn,

I am using the method shown below, or something similiar.

The mdb I am opening has a startup form which normally opens automatically
when I open the mdb, but this does not happen with this code. How can I
force the startup form to come up?

Additionally, If I call this file from the command line, and pass it a
couple of parameters, it will run unattended. So, my second question is how
do I pass the application a command line parameter using VB script?

> Const Target = "D:\Data\db1.mdb"
> With CreateObject("Access.Application")
> .OpenCurrentDatabase Target
> End With
> WScript.Sleep 100

"Miyahn" wrote:

> "Dale Fye" wrote in message news:579B6AD1-C226-461A-8706-F231E7EE9D8F@microsoft.com
> > I am totally new to vbScript.
> >
> > I have an Access application that I want to kick-off using VBscript, but I
> > have not been able to figure out how to do it. I would like the script to
> > open the application in hidden mode, then execute the Autoexec macro that is
> > in the app.
>
> Try this.
>
> Const Target = "D:\Data\db1.mdb"
> With CreateObject("WScript.Shell")
> .Run Target, 0
> End With
> WScript.Sleep 100 ' a charm
>
> (Different from Excel)Access terminates when the parent process terminates.
> Compare with this.
>
> Const Target = "D:\Data\db1.mdb"
> With CreateObject("Access.Application")
> .OpenCurrentDatabase Target
> End With
> WScript.Sleep 100
>
>