Report.FormatCount Property
Access Developer Reference |
You can use the FormatCount property to determine the number of times the OnFormat property has been evaluated for the current section on a report. Read/write Integer.
Syntax
expression.FormatCount
expression A variable that represents a Report object.
Remarks
You can use this property only in an event procedure specified by a section's OnFormat property setting.
This property isn't available in report Design view.
Microsoft Access increments the FormatCount property each time the OnFormat property setting is evaluated for the current section. As the next section is formatted, Microsoft Access resets the FormatCount property to 1.
Under some circumstances, Microsoft Access formats a section more than once. For example, you might design a report in which the KeepTogether property for the detail section is set to Yes. When Microsoft Access reaches the bottom of a page, it formats the current detail section once to see if it will fit. If it doesn't fit, Microsoft Access moves to the next page and formats the detail section again. In this case, the setting for the FormatCount property for the detail section is 2 because it was formatted twice before it was printed.
You can use the FormatCount property to ensure that an operation that affects formatting gets executed only once for a section.
Example
In the following example, the DLookup function is evaluated only when the FormatCount property is set to 1:
Visual Basic for Applications |
---|
|
See Also