How do I add a row number to a report?
I want to add a field in addition to my report fields that will contain a sequence starting at 1 for each row displayed in my report.
Thank you
Create a textbox control in your Detail Section of the report and name it RecNumber. Update it's Format property with #,##0 Open the Forms code window. Put the following code at the Report declarations level:
Dim vRecNumber As Long
Put the following code in the Detail Sections OnFormat event procedure:
vRecNumber = vRecNumber + 1
Me![RecNumber] = vRecNumber
Your report will now have an incrementing control starting with 1 without any gaps through the number of rows printing in the Detail Section.
If you need further help just respond back with questions.
CosmosKramer: Love your handle. Your entry must be magnificant. I also like your solution. Much easier than mine. I learned something new already today so the day is a successful one.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.