[mso] Re: Access Report Line numbers

This seems to work (Access 2003 although the database is in 2000 format).

You're going to need a VBA class module for the report.  These don't seem to 
be set up automatically, so you'll need to create it yourself ...

In the Access report design window, right click on the dark grey part of the 
window (below the report footer) and select the "code builder" option. 
That'll create and open a class module for the report.  Then replace its 
entire contents with:


Option Compare Database
Option Explicit

Private mRowNumber As Integer

Private Sub Report_Open(Cancel As Integer)
  mRowNumber = 0
End Sub

Public Function RowNumber() As Integer
  mRowNumber = mRowNumber + 1
  RowNumber = mRowNumber
End Function


Then, create a field in your report with the function call:

  =RowNumber()

The class module defines a persistent member "mRowNumber".  This is cleared 
by the "report open" event, and incremented at each call to RowNumber().

Regards, Dave S

----- Original Message ----- 
From: "RONALD CHESHIER" <cheshierron@xxxxxxx>
To: "Access User Group" <mso@xxxxxxxxxxxxx>
Sent: Friday, July 28, 2006 1:43 PM
Subject: [mso] Access Report Line numbers


> Hi folks, hope all are well.
> I need a little help with an ACCESS report I have designed.  The report is 
> used to order items for my Laboratory.  It is a table format.  If I order 
> more than one item from a supplier the table contains each item with it's 
> catalogue number, description, cost, etc.  I would like to be able to 
> automatically add a line number for each item and the line number would 
> only exist if there is an item. So, if I had 5 items on my list there 
> would be a cell for each showing 1,2,3,4 and 5 ( but no 6 as there are 
> only 5 items). I have tried set up a text control that uses a formula like 
> N=N+1 with N=0 as a start point but that doesn't work.
> Anyone have any suggestions.
>
> Thanks for the help.
>
> Ron
>
>
> *************************************************************
> You are receiving this mail because you subscribed to mso@xxxxxxxxxxxxx or 
> MicrosoftOffice@xxxxxxxxxxxxxxxx
>
> To send mail to the group, simply address it to mso@xxxxxxxxxxxxx
>
> To Unsubscribe from this group, visit the group's homepage and use the 
> dropdown menu at the top.  This will allow you to unsubscribe your email 
> address or change your email settings to digest or vacation (no mail).
> http://www.freelists.org/webpage/mso
>
> To be able to use the files section for sharing files with the group, send 
> a request to mso-moderators@xxxxxxxxxxxxx and you will be sent an 
> invitation with instructions.  Once you are a member of the files group, 
> you can go here to upload/download files:
> http://www.smartgroups.com/vault/msofiles
>
> If you are using Outlook and you see a lot of unnecessary code in your 
> email messages, read these instructions that explain why and how to fix 
> it:
> http://personal-computer-tutor.com/abc3/v28/greg28.htm
> *************************************************************
> 

*************************************************************
You are receiving this mail because you subscribed to mso@xxxxxxxxxxxxx or 
MicrosoftOffice@xxxxxxxxxxxxxxxx

To send mail to the group, simply address it to mso@xxxxxxxxxxxxx

To Unsubscribe from this group, visit the group's homepage and use the dropdown 
menu at the top.  This will allow you to unsubscribe your email address or 
change your email settings to digest or vacation (no mail).
http://www.freelists.org/webpage/mso

To be able to use the files section for sharing files with the group, send a 
request to mso-moderators@xxxxxxxxxxxxx and you will be sent an invitation with 
instructions.  Once you are a member of the files group, you can go here to 
upload/download files:
http://www.smartgroups.com/vault/msofiles

If you are using Outlook and you see a lot of unnecessary code in your email 
messages, read these instructions that explain why and how to fix it:
http://personal-computer-tutor.com/abc3/v28/greg28.htm
*************************************************************

Other related posts: