Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

‘Print To File’ for Access Reports Under Software Control

Posted on 1997-12-18
2
Medium Priority
?
305 Views
Last Modified: 2008-02-01
    I’m attempting to determine how I can print a Microsoft Access97 Report to a File strictly under software control. By that I mean to print it through a standard printer driver (such as ‘HP LaserJet 4’), but route the output to a file instead of the physical port. If all works as desired the file could later be copied to the port (e.g. COPY FILE.PRT LPT1:) to produce the final output. All of this MUST be done under program control with no user interaction.

     To give you a somewhat larger picture, I have a custom application written in Visual Basic (5.0 EE) which uses Microsoft Access97 to generate a large number of reports. I am in the process of  enhancing the app to interface to a FAX server back-end. My app needs to generate the files described in the previous paragraph to pass to the FAX server to image the pages to be sent over the modem/phone line.

     All of the components run under Windows NT 4.0

     I’ve looked at the Access97 OutputTo, but this is unsuitable, since all graphics are not rendered.

     The Access97 PrintOut method seems similar to the Word97 ‘FilePrint’ method but, unlike the latter, does not support a OutputToFilename argument.

     I’ve tried digging through the SDK documentation of the MSDN library regarding the DEVMODE and DEVNAMES structures, but havn’t found what I’m looking for. I’ve even tried tweaking the prtDEVNAMES structure for Access97 reports by modifying the ‘port’ member of the structure to ‘FILE:’ or the path of a file (e.g. ‘C:\TEST\TEST.PRN’) with no luck. I’ve done similar things with a printer installed which uses the ‘FILE:’ port (which would be ok if it didn’t throw-up a dialog asking the user for a file name!)

     As I said earlier, all functionality must be controllable within software – solutions which rely, for example, on a user entering text (i.e. a filename) into a dialog box will not fly.

     Got any suggestions?
0
Comment
Question by:JimW
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 9

Accepted Solution

by:
cymbolic earned 400 total points
ID: 1962962
For faxing reports from MS Access, see Microsfot Knowlege base article Q145787, with samples in articles Q145787 and Q175072, at the Microsoft Technical Suport site on the web
0
 

Expert Comment

by:harlanh
ID: 1962963
This ACC97 function uses SendKeys to Check the 'Print to File' box for the currently selected printer and then sends the path and filename to the filename dialog box.  I have used a similar function to select a Linitronic 530 (psuedo) printer to create Postscript (PS) or Encapsulated Postscript (EPS) files.

'------------------------------------------------------------
' PrtEPS(strFN, strRpt)
'
' strFN is path and filename
' strRpt is Report Name from Reports Tab of Database Window
'------------------------------------------------------------
Public Function PrtEPS(strFN As String, strRpt As String)
Dim strCmd As String

strCmd = "%l{ENTER}"
strCmd = strCmd + strFN
strCmd = strCmd + ".PCL{ENTER}"

DoCmd.SelectObject acReport, strRpt, True
SendKeys strCmd, False
DoCmd.RunCommand acCmdPrint

End Function
0

Featured Post

Does Your Cloud Backup Use Blockchain Technology?

Blockchain technology has already revolutionized finance thanks to Bitcoin. Now it's disrupting other areas, including the realm of data protection. Learn how blockchain is now being used to authenticate backup files and keep them safe from hackers.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question