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).
Note:
(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 RunTimeDownload Access XP & 2K: http://www.rogersaccesslibrary.com/forum/uploads/37/PrintExternalFiles.zip - uploads/37/PrintExternalFiles.zip
------------- --
Email: mailto:adtejpal@gmail.com - adtejpal@gmail.com
|