PC Forms: Incorrect Data Printed from Subform (107357)
The information in this article applies to:
- Microsoft Electronic Forms Designer, when used with:
- Microsoft Mail for PC Networks 3.0
- Microsoft Mail for PC Networks 3.2
This article was previously published under Q107357 SUMMARY
When you print a custom form created using version 1.0 of Microsoft
Electronic Forms Designer, information in subforms may not print as
expected. When E-Form Caching is turned on, information from a previous
instance of the subform may print instead of the current data.
CAUSE
The instructions listed in the "Adding Modal and Modeless Subforms" section
(pages 98-102) of the Microsoft Electronic Forms Designer "Developer's
Guide" will place code in correct locations for reading subforms. However,
it does not provide instructions for properly handling printing of subforms
when caching is turned on.
The method outlined in the "Developer's Guide" is for the
ReadTaggedControls function to be called in the Load event of a subform.
When a subform is opened, ReadTaggedControls reads the subform's data from
the MEF package. If a custom message is read and the Print command is
issued before the subform is opened, the Load event for the subform does
not take place. Consequentially, the ReadTaggedControls function is not
called to retrieve the subform's data from the package. When caching is
turned on, the cached data for the subform is used and will print.
WORKAROUND
To work around this problem, you must read the subform data from the
package when the e-form loads, rather then waiting to read the data when
the subform is opened. To do so, perform the following steps to add code to
the ReadMessage function defined in the EFORM.BAS file:
- Open the E-Form project in Microsoft Visual Basic.
- Open the EFORM.BAS file.
- In the Proc: list box, select ReadMessage.
- Add the ReadTaggedControls function for each subform below the comment
"Add code here to unpackage your data."
For example, if there is a subform named frmHardware, add the following
line of code:
ReadTaggedControls frmHardware, gPackage - Remove the ReadTaggedControls function from the Load event for the
subform. From the Project window, select the subform and choose the View
Code button.
- From the Object: list box, select Form.
- From the Proc: list box, select Load.
- Delete the following line of code:
ReadTaggedControls Me, gPackage
The subform's data will now be read from the package when the form is
opened and will be available to the print procedure regardless of when the
subform is read.
Modification Type: | Minor | Last Reviewed: | 8/16/2005 |
---|
Keywords: | KB107357 |
---|
|