Microsoft KB Archive/128223

= ACC2: OnFormat Event Procedure Triggered Too Early =

Article ID: 128223

Article Last Modified on 11/6/2000

-

APPLIES TO


 * Microsoft Access 2.0 Standard Edition

-



This article was previously published under Q128223





SYMPTOMS
Advanced: Requires expert coding, interoperability, and multiuser skills.

The OnFormat event procedure is triggered on the page before a group header or a group footer section is printed. This problem happens when the ForceNewPage property is set to Before Section to force the section to print on the next page. For example, the event is triggered on page 1, but the section prints on page 2.



CAUSE
If a group header or group footer section's Height property is set to 0 inches, the OnFormat event property is triggered before the section is moved to the next page rather than after.



RESOLUTION
To work around this problem, set the group header or group footer section's Height property to at least .007 inches.



STATUS
Microsoft has confirmed this to be a problem in Microsoft Access version 2.0. This problem no longer occurs in Microsoft Access version 7.0.



MORE INFORMATION
The behavior described above can also reset the page number for a group header or group footer incorrectly.

Steps to Reproduce Behavior
CAUTION: Following the steps in the example will modify the sample database NWIND.MDB. You may want to back up the NWIND.MDB file, or perform these steps on a copy of the NWIND database.

  Open the sample database NWIND.MDB, and create a new macro as follows:

     Macro Name          Action --     GroupHeaderFrmt     MsgBox

GroupHeaderFrmt Actions ---     MsgBox Message: =[Category Name] & " " & [Page]  Open the List Of Products By Category report in Design view. Move the Category Name text box in the Category Name group header section to the detail section.  Set the properties for the Category Name group header section as follows:

<pre class="fixed_text">     ForceNewPage: Before Section OnFormat: GroupHeaderFrmt Height: 0 </li> Preview the report. Note that the message box displays "Beverages1."</li></ol>

Steps to Work Around Problem

 * 1) In step 4 above, increase the Category Name group header section's Height property to .007.
 * 2) Preview the report. Note that no message is displayed until you preview page 2.

<div class="references_section">