Home  Fees/Services  Access Examples  Tutorials  Access Download  Articles  Search  Contact  Privacy  Links
Access Report Examples





Access Report Design Tutorials

Report Line Counter
Change Line Color
Report Running Sum
Report Page Subtotals
Graphics Overlay
Dynamic Crosstab
Report Mail Merge


Line Counter In Access Reports

Displaying line counter numbers next to detail report detail lines is useful for purchase order and contract details reports in Microsoft Access. Here's an example of how to implement this feature using Access reports VBA code.

Follow these steps:

Create a global variable as show in the image just below the 'Option Compare Database' line.



Since 2000 we have developed 100's of databases for clients throughout the world. See a sample of them at our recent clients page.

Do you and your clients need access to data on the Internet? We can create a secure system to match your requirements perfectly.


Create an 'On Print' event procedure for the Detail section of the report.  In this visual basic procedure increment the line counter variable by one each time.  Then the VBA Code assigns the result to an unbound report field called 'Line_Counter'.

Print preview of the resulting increment line counter report is shown below:

Access Report Line Counter

 

Incremental Counter VBA Code

Note that you can also do a incremental line counter by using an unbound field with control source =1 in combination with the running sum property set to yes.   We provide this visual basic example because there may be other calculations what you may want to perform within the report and this example gives you the basic skills needed to do the other calcs.  Some examples of other calculations might be calculation of standard deviation, mean, and other statistics.









A Blue Claw Database Design Article:

ODBC Links To Other DB Systems
 

Contact Information

Microsoft Access 2013 2010 All Windows Versions

Copyright 2000-2017 Blue Claw Database Design