TX Text Control ActiveX

Printing More Than One Record

Topic

A print queue collects records and prints them together. The second part of the Visual Basic mail merge sample sets one up: the user browses through the database and merges single records into the document, as in Merging Database Data and Text, adds single records to the queue and starts printing the queue on command.

The source code of this part is in the Samples\vb6\MailMerge\Step2 directory.

How the Print Queue Works

The queue is a list box. Adding a record adds the company name of the current record to it, and this name stands for the record: when the queue is printed, it is replaced by the actual data of the record.

The document is printed in the background. For this, Form2 of the sample project has a second, invisible TXTextControl named TXHidden, which is filled with the template and receives the merged data.

Reuse the Merge Routine

The sample doesn't need a second routine for merging. The Merge routine of the first part is changed a little and defined globally. It now receives the TXTextControl in which the merging takes place as a parameter, so that it works with the visible and the hidden control. In addition, the records from the database are now merged into the Marked Text Fields and no longer into the label captions.

Next Steps