How can I open an ACCESS mdb and call a specific program? Not Auto

G

Guest

Does anyone know of a way to execute an ACCESS mdb and call a specific
program other than using the AutoExec macro.

Using a ".bat" file, I want to execute an ACCESS mdb and open a specific
program/form.

Thanks
 
A

Albert D. Kallal

The following is a windows script (which is a windows batch file in a sense)

dim accessApp

msgbox "Click ok to run batch job",64

set accessApp = createObject("Access.Application")

accessApp.OpenCurrentDataBase("C:\Documents and Settings\Albert\My
Documents\Access\ScriptExample\MultiSelect.mdb")

accessApp.Run "TimeUpDate"

accessApp.Quit

set accessApp = nothing

msgbox "Job complete", 64

If you pate the above code into a text document (notepad),and then re-name
the text document to have a vbs extensions, then congratulation, you just
built your first windows script.

the above example opens the mdb file,and then executes a sub called
timeUpDate (a public sub in a standard module).

The script as above is more preferred then a dos batch style file.

You could also I suppose consider using a dos ".bat" type file, and include
a command line switch to execute a macro of your choice, but I find the
above better, as you can quit, and control ms-access considerable better.
Also, keep in mind that the mdb might have start-up forms (and thus code)
that runs. I often make JUST a simple mdb file with the code, and a linked
table to the data. This mdb can thus be automated as above, and you can even
use the windows scheduler to launch the .vbs script...

Give the above a try....
 

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