Hybrid - Purchasing Terms & Conditions Example

This example shows how you can call a Dexterity report from Visual Basic for Applications (VBA).  The report can be either a built in report or a custom report.  If a built in report is used security will define whether the original, modified, alternate or modified alternate version will be printed.

This specific example will print a Purchasing Terms & Conditions report for each Purchase Order printed via the "POP Purchase Order Blank Form" report.  The VBA code counts how many times the Report Header section is printed.  It then uses the Continuum Integration Library to execute pass through Dexterity sanScript.

The Dexterity code uses the POP_PrintDocList_TEMP table as a dummy temp table to create one record for each copy of the Purchase Order Terms and Conditions needed. It then runs the custom report "Purchasing Terms and Conditions" which will print one page for each record in the table.  The code also handles the Named Printers selection if Named Printers is being used.  This approach allows a single multiple page report to be printed, rather than multiple single page reports.

One final hint: If you are having trouble getting the actual wording for the Terms and Conditions to display/print nicely due to having to use multiple static text fields for each line, try the solution mentioned in my posting, How to get large amounts of text to look good on a report.

NOTE: This customisation uses a method of executing Dexterity sanScript code from VBA which is unsupported by Microsoft.

Example code for v8.0, v9.0 & v10.0 is attached at the bottom of the article.

Please see the "Installation Instructions.txt" file in each version's archive for more information.

Purchasing Terms & Conditions Example.zip