Roger's Access Library Homepage
Forum Home Forum Home > Other Download Libraries > MS Access MVP Libraries > Tejpal, A.D.
  New Posts New Posts RSS Feed - PrintExternalFiles.mdb
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Please consider donating $1 per sample downloaded, (find out why here)


 Post Reply Post Reply
A.D. Tejpal View Drop Down
Microsoft MVP
Microsoft MVP

Joined: 30 Jun 2008
Status: Offline
Points: 192
Post Options Post Options   Thanks (0) Thanks(0)   Quote A.D. Tejpal Quote  Post ReplyReply Direct Link To This Post Topic: PrintExternalFiles.mdb
    Posted: 08 Jul 2008 at 10:20pm
This sample db demonstrates viewing / printing of external files by clicking a 
command button on an access form. Two methods are demonstrated:
    (a) FollowHyperLink method.
    (b) ShellExecute() API call.
    All the documents required to be printed are to be placed in a special folder 
named PrintJobs, located in the same folder as the sample db
    Two styles are covered:
    (a) Viewing / Printing of individual files, one at a time.
    (b) Batch printing of selected files.
    In single file mode, whenever, the pertinent form opens, paths & names of all files 
in folder PrintJobs (as well as all its sub-folders if any) get loaded in a table, thus 
populating the look-up list for the combo box. The selected file can be viewed / 
printed on clicking the Print button.
    In batch-print mode, the files table can be freshly re-loaded with paths & names 
of all files in folder PrintJobs (as well as all its sub-folders if any), by clicking a 
command button whenever desired. All selected files get printed on clicking the 
Print button.
    For the sake of demonstration, sample files with extension pdf, doc, rtf, txt, snp 
(snapshot) and prn have been included in various subfolders in the folder PrintJobs. 
The last type, i.e. .prn file gets created when PrintToFile option is used in print 
dialog box. The sample file was created via HP 610-C printer driver. (Batch-print 
mode is confined to pdf, doc, rtf and txt files).
    (1) Prn files:
        (a) The last file type (.prn type) is included mainly for academic interest, as it is 
              used comparatively rarely . These files (in printer language) are bulky in 
              size and are created by choosing PrintToFile option in Print dialog box, for 
              subsequent printing directly via DOS command (without needing to re-
              open the original document). Printing gets done faster and does not 
              depend upon the parent application. Typical situations, meriting use of 
              such files are excel worksheets (with special selection of ranges), or 
              frequently needed prints of certain specific pages of other documents.
        (b) In the sample db, printing of .prn files is achieved by run-time creation of 
             batch file and activation thereof for executing the print job. This will work 
             only where the installed printer matches the printer driver through which the 
             file was originally created.
    (2) After completion of printing, the user should check for any parent application 
         still remaining open and close the same if desired..    
    References - DAO 3.6, MS Scripting RunTime

Download Access XP & 2K: uploads/37/


Back to Top
Sponsored Links

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.03
Copyright ©2001-2019 Web Wiz Ltd.