How to automate access from cmd.exe?

  • Thread starter Thread starter Siegfried Heintze
  • Start date Start date
S

Siegfried Heintze

I would like to automate some testing procedures via a bat file for cmd.exe
(or a bash script using cygwin).

How can I automate
(1) The creation of a MSAccess database?
(2) the population of that database with XML that contains the data and the
table definitions
(3) dumping the table contents of the tables and the table defintions back
to a XML file?

Incidently, this next question is off topic but I really don't know where to
look. Is there a news group from cmd.exe?
Here is the question: in bash I can do this:

myprogram.exe <<EOF
data goes here to be read as stdin by my program.
my program stops reading after this line.
EOF
nextprogram.exe

How can I do this with cmd.exe?

Thanks,
Siegfried
 
To be honest, I'm not sure how much of that you can do using a bat file, but
it can certainly all be done automating Access using VBScript.

You'd need to instantiate an instance of Access:

Dim appAccess

Set appAccess = CreateObject("Access.Application")

Once you've done that, you should be able to create a new database using

appAccess.CreateDatabase("C:\Folder\File.mdb")

You'd use TransferText to import the data from XML and dump the data to XML.
 
Back
Top