Good day,
I would like to query several Access databases in a batch process. If it can be done in the background without needing to open the database, it'd even better, but that's not essential.
I know a bit about SQL and Access, but not about VB or VBA.
This is what I can do: I can open the .mdb file and run the query and see the results.
I would like to do the same thing from the command line for several databases. Something like this (imaginary syntax) should work for one database:
Having that would already be great. For several databases, I imagine I would need to write a loop:"C:\Program Files\Microsoft Office\Office\MSACCESS.EXE" "d:\My Documents\cl97.mdb" q:"SELECT Dictionaries.DictName FROM Dictionaries;" > C:\results.txt
The results.txt file looks includes the name of the database plus the results of the query (the values of the "DictName" fields).foreach db in X:\path\to\*\ {
"C:\Program Files\Microsoft Office\Office\MSACCESS.EXE" "$db" q:"SELECT Dictionaries.DictName FROM Dictionaries;" >> C:\results.txt
}
Is it possible to do any of the above stuff? I've been searching the web but I couldn't find a clear explanation.
Thank you so much!
Cheers, Manuel