Hack 36. Put Line Numbers on a Report
Use the Running Sum property to include an incremental counter in your report.
Sometimes you might want to include line numbers on a report. This is fairly easy to do. The trick is to include an unbound text box, set its Running Sum property to Over Group or Over All, and set its Control Source to the starting value.
Figure 4-31 shows a report in Design mode. The text box on the left is unbound and will display an incremental value when the report runs. The property shows how its control source is set to =1, the beginning value.
Figure 4-31. A text box to display line numbers
Figure 4-32 shows how the report looks when run.
The value placed in the Control Source property not only provides the seed value, but also serves as the increment value. When a value of 1 is used, the counting starts at 1 and increments by 1. You can use other values as well. For example, a value of 10 might be desirable, in which case the counting starts at 10 and increments by 10, as shown in Figure 4-33.
Figure 4-32. Displaying a report with line numbers
Figure 4-33. Lines counting by tens