In the past, some of our customers have asked, “How do I add a reference number to each line on my reports?”. While this could be done manually using a custom field, if you are looking for an automated way to generate a counter next to each line item, please review the instructions on this blog. This is likely one of the most simple customization requests as all you need to do is add 3 lines of code and 1 text box:

 

 

 

 

 

Please note this instruction is intended for users with experience on customizing reports, and some of the elementary steps are omitted.

On the Designer side, add a text box “txtCount” next (or before) each item, as shown below:

 

You can also add the header on the grpHeader as shown below:

 

On the Script side:

1- Go to the desired group/detail section (usually  Sub grpItemHeader_Format)

2- Add the following code:

txtCount.Value = count

count = count + 1

 

3- Declare a private count on the “Imports” section, all the way on the top of the report:

private count as integer = 1

 

This is what the report code would look like:

This is it!

Shall you need any further assistance, please contact us at support@d-toolshelp.com