Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run MS Access query?

Status
Not open for further replies.
Dec 13, 2002
109
GB
Hi

Does anybody know if its possible to run an Access query automatically. Ideally initiated from a bat file?


Cheers

Ronald
 
To start off, I am no expert. That having been said, need some additional information.

1) You reference .BAT file Are you working in W95/98/ME or are you operating in NT/2000/XP?

2) If you are running an an Access Query, what and where are you going to use the data?

I have scripts that are run on an NT server. Although NT will recognize .BAT extension, the newer extension I believe is .CMD Then end result is the same.

In my situation, I have a .CMD file call a .VBS script that runs a query in ACCESS 97 and then posts data to an Excel spreadsheet, and is scheduled using AT/WINAT, although on Win2000 or > taskscheduler would work. Again in my environment, I am using DSN to connect to the database using ADO.

If you can provide some more information, would gladly try to point you to some resources..

Doug Cranston
 
Hi Doug,
What you just describe is exactly what I'm looking to do.Do you have a sample of your BAT or CMD file?? I also am creating Excel files from Access Queries under Win 2K. I then send those excel files to appropriate persons. Come to think of it it would be cool if I could somehow send thes files by email automatically rather than to create a separate email for each one of my 50 queries.


Thanks any help or links would be greatly appreciated!!
 
I have a sample, sans the mdb, but it is to long to post.

Post a response with your email and will send you a copy of it.

Includes commandline switches, pulling data from Access, creating MULTIPLE worksheets with individual data and formatting them, error handling (primative) and emailing via CDONTS or CDOSYS depending on your server environment and installed services.

I am not a programmer, and what is in this file is a culmination of alot of web searching, trial, error and rework. It is a a work in progress.

Unfortunately there is not alot of on using VBS, so looking at and adapting VBA and VB code gets in the effort too.

DougCranston
 
Thanks Doug
My email is saguiler@matrox.com. I realize it's a work in progress but I'm sure it will point me in the right direction. I really appreciate it.

Sebastian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top