export report to a .bat file

  • Thread starter Thread starter The Boondock Saint
  • Start date Start date
T

The Boondock Saint

Is there a way you can export a report to a .bat file...

Ive got a report with data that i need to be put into a bat file.

Id also like it to automatically write over the .bat file if it already
exist.

Any ideas if this can be done?
 
Why would you want to export it to a .bat file?? A .bat file is a script
file. Mybe you really meant .txt, .csv or other file format.

Regards,
Graham R Seach
Microsoft Access MVP
Canberra, Australia
 
thank Graham.... its because the contents of the bat are commandlines that i
want to be able to run and these come from the report
 
You could try this.

DoCmd.OutputTo acOutputReport, "rptMyReport", acFormatTXT,
"c:\Temp\mybat.bat"

Regards,
Graham R Seach
Microsoft Access MVP
Canberra, Australia
 
Do I make a macro and put it in there?
I tried it in a macro in the database but its coming up with a error...

Sub testing()
DoCmd.OutputTo acOutputReport, "rptThumbnail Query", acFormatTXT,
"c:\blackbox\mybat.bat"
End Sub
 
By default Access can't export to .bat files, because
they are script files and someone might write a database
which wrote an evil script.

So, you can use VBA to write to a file,

Or you can use VBA to kill an existing file, (KILL)
then use Access to write to a .txt file,
then use VBA to rename the file as .bat (NAME)

Or you can change the Jet registry entry "DisabledExtensions"
to include .bat

(david)
 
Thanks David.... you gave me a interesting thought...

If i can get access to save it as a text file....
Then make a .bat.... which renames the text file to a .bat and then runs
that bat file....

that should work.....

now i just need to find a way to automate the saving of the report to the
text file
 
You said it was a report! Of course it's not working! There IS a difference
between a report and a query.

DoCmd.OutputTo acOutputQuery, "rptThumbnail Query", acFormatTXT,
"c:\blackbox\mybat.bat"

Regards,
Graham R Seach
Microsoft Access MVP
Canberra, Australia
 

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

Back
Top