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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Want to create a batch job to open access an print a report to two pri

Status
Not open for further replies.

jalby

MIS
Jun 29, 2002
17
US
I am a newbie to the field. I had received a request to print a report to two differn't printers. They would like the report real time however, the system they use will not perform this functionality.

I had a thought that if I create a SQL report through access possibly I could use a batch file to execute the report and print the results to the location. I could then create a scheduled job task to run the batch every hour.

I have no background in batch scripting an would appreciate any feedback on if this can be done and how one would do it.

Thanks,
 
Can you shed some light as to the end-file that the sql will produce?

If the end-file is in a structured ASCII format, then you might be able to use Notepad to execute the actual printing. Just as a side note..it will most likely print to the defaulted (usually local) printer--you may have to capture the port--though, I'm not sure if a networked one will pose any problems.

If the end-file is in a different format (like Crystal Report, or if it's a stored procedure call) you may want to use Access' VBA to produce the printout. It may be a little tricky, but I'm confident it can be done.

Let us know what format you will be using for the end-file and we may better advise you.
--MiggyD

Never be afraid to try something new. Remember that amateurs built the Ark. Professionals built the Titanic.
 
The end file would be a text file. Thanks
 
Here's the syntax for printing with NOTEPAD:

C:\WINDOWS\NOTEPAD.EXE /p %1

where %1 would be the FileName to be printed (including extension)

Example:
Notepad.exe /p "This is the file to print.txt"
Notepad.exe /p "Web page source code.html"
(etc....)

This would normally be called from a DOS prompt, but can be called through VBA using the SHELL statment and don't forget the double quotes (especially if the file uses LFNaming). As for the Header/Footer info, that stuff must be changed through the registry. You'd need to add some Keys and have them be empty.

Test out the above (a dry run if you will) of the expected text file...and see if this is what you want first.

If so, write back and I'll give you more details to remove the headers/footers. Keep in mind that it should print to the defaulted printer on that station, so if someone changes it then it'll print elsewhere.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top