Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Running Access queries via vbscript

545 views
Skip to first unread message

Ian Joyce

unread,
May 17, 2001, 10:07:44 AM5/17/01
to
Is there any way to run an Access query or macro via vbscript?

Steve Sinclair

unread,
May 17, 2001, 5:16:46 PM5/17/01
to
On Thu, 17 May 2001 07:07:44 -0700, "Ian Joyce"
<idream...@yahoo.com> wrote:

>Is there any way to run an Access query or macro via vbscript?

'
' Run under CSCRIPT
'
Dim oDB
Dim dpPath

dbPath = "D:\Databases\Test01.mdb"
Set oDB = GetObject(dbPath)
oDB.DoCmd.RunMacro "macTestAuto"

Set oDB = Nothing
Wscript.Echo "Done..."


Steve

Ian Joyce

unread,
May 18, 2001, 2:27:38 PM5/18/01
to
great, thanks. Now, is there a way to pass arguments to the macro? Thanks again.


Steve

.

Mark Teasdale

unread,
May 19, 2001, 12:40:31 PM5/19/01
to
Running the Macro

This should work
"C:\Program Files\Microsoft Office\Office\Msaccess.exe" _
"C:\Program Files\Microsoft Office\Office\Samples\Northwind.mdb" _
/x "Orders"

/x macro Starts Microsoft Access and runs the specified macro.
Another way to run a macro when you open a database is to use
an AutoExec macro. Access database or Access project

You can also create a macro called autoexec and it will auto run when access
is opened. Making the previous example work.


For more information on switches go to MS Access help "Startup command-line
options"
and for more info on Autoexec go to "Carry out an action when my database
first opens"

Mark Teasdale
I only wish I know as much about VBS as I do Access


Ian Joyce <idream...@yahoo.com> wrote in message
news:<0a7501c0dfc8$37489210$b1e62ecf@tkmsftngxa04>...


Steve

.

----------

Ian Joyce <idream...@yahoo.com> wrote in message
news:0a7501c0dfc8$37489210$b1e62ecf@tkmsftngxa04...

0 new messages