Creating a Column of Numbers

  • Thread starter Thread starter Black_Hole
  • Start date Start date
B

Black_Hole

Guest
I am trying to create a column of numbers in the report so as to when a new record is entered it will generate a number. Now here is the catch thats been bugging me; the number cannot in any way be associated with the record it sits beside. The only purpose of this number is to sit to the left of the page and generate the next number in order (1, 2, 3 ,4 .. . .) when a new record is entered in. When a new record is entered what happens to me right now is that when it sorts it by the last name, it jumbles the numbers all around. I have been told to use the count function by a few friends but to no avail can I work with it. I appreciate any help that can be given.
 
These numbers are just to appear on the report, right? Just to number each record?

If so, all you have to do is use a global variable to count each record.

Define a global variable by inserting a dim statement at the module level of your report module. That would be right after the Option Explict statement:

Option Explicit
Dim intRecordCount As Integer

Then add a text box to the detail section to hold the number. Call it something like txtRecordNumber.

Then in the OnFormat event of your Detail section enter the statements:

intRecordCount = intRecordCount + 1
Me!txtRecordNumber = intRecordCount
 
Add an unbound text box to the report, set its control source to =1 set the running sum property to over group.
 

Users who are viewing this thread

Back
Top Bottom