Provided by Allen Browne, allen@allenbrowne.com
In addition to the OnFormat and OnPrint events (see Reports: Page Totals for an example), Access 2 and later provide three True/False properties:
Each is normally set to True, but the combination of the three allows fine control over what is printed when and where. For example, a report's readability might be enhanced by a blank line every five records.
Need some explanation? In line 9, the statement inside the brackets evaluates to True when the line counter is an exact multiple of 5 (i.e. the remainder is zero). This True/False result is assigned to fBlankNext, so this flag becomes True every fifth record.
When the next record is about to print and fBlankNext is True, lines 3~5 will execute. MoveLayout is still True, but PrintSection is False, so Access moves down a line and prints nothing. This gives a blank line, at the expense of the record that wasn't printed! By setting NextRecord to False (and resetting our fBlankNext flag), the missed record stays current and is printed next time.
Home | Index of tips | Top |