How to add a sequence number in front of each row on the report

A

Ally

Would you please kindly tell me how to add a sequence number (1, 2, 3,...,
etc.) in front of each row printed out on the report so that in the meeting
each item can be referred as the item No. and easier to be found among
several hundred rows?

Many thanks!
 
F

freakazeud

Hi,
create an unbound textbox control on the report.
Set its value to 1 in the controlSource property. Now pay attention to the
RunningSum property of controls. You can set it to either Over All or group.
HTH
Good luck
 
O

Ofer

Create a field in the report
In the control source write =1
The Running sum property change to Yes
 
A

Ally

Ofer,

Thanks very much for your reply. The problem is that I don't know how to
create a field in the report. The report in my database is created by a
query. I select the columns that I would like to display on the report from
Field List that was from underline query. How do I create a field in the
report that was not from Field List?

Thanks,

Ally
 
F

freakazeud

Hi,
you don't want to create a field, but a control in the report. Reports don't
hold fields (these are in tables), but controls.
Create a textbox control in design view on the report. Then follow the steps
provided.
HTH
Good luck
 
O

Ofer

My mistake, you right
TextBox, not field



Ally said:
Ofer,

Thanks very much for your reply. The problem is that I don't know how to
create a field in the report. The report in my database is created by a
query. I select the columns that I would like to display on the report from
Field List that was from underline query. How do I create a field in the
report that was not from Field List?

Thanks,

Ally
 
O

Ofer

It's not realy unbound, it's bound to =1

Write the control source of the TextBox you created =1
 
F

freakazeud

Set its value to 1 in the controlSource property (=1)!
It is unbound as it is NOT bound to a field in a query or table!
HTH
Good luck
 
A

Ally

Thanks so much to you all! It works!!!!!

Ally

freakazeud said:
Set its value to 1 in the controlSource property (=1)!
It is unbound as it is NOT bound to a field in a query or table!
HTH
Good luck
 
Z

zyus

How to make item numbering that will restart from number 1 on each page...i
followed what you hv suggested but the number runs over all pages...

Say i hv 100 records with 10 records for eah page and i want the item number
to start from 1 ...to 10 for each page...not running from 1 to 100
 
D

Douglas J Steele

Put code in the Format event of the PageHeader section to reset the item
number.
 
A

Ally

Would you please kindly help me to see why the list box on a form was not
filter out?

I have a form (form#1) with a list box called "lstCName" displayed on the
top of the page. The list box includes a list of capital items with Project#
(column 1), Cost center number (column 2), Item description (column 3),
Estimated cost (column 4) and FiscalYear (column 5) displayed on the top of
the page. The column 1 (Project#) is the BoundColumn used for command buttons
(such as Edit, New, Add) in the form. It works fine itself with all command
buttons
funtioning correctly. The only issue is that form#1 displays capital items
of all fiscal year (FY) starting FY 05 to FY 09 and the list is just simply
too long to look through one capital item in one specific fiscal year. (I do
have a search function in the form#1, but I still think I need to filter the
form#1 out by Fiscal Year so that I can just look at the capital items for
one or two fiscal year as I would like).

Therefore, I am thinking about adding form#2 to select FiscalYear and
display all capital items in the form#1 for the fiscalyear that I choose from
form#2. Form#2 has a list box called "FiscalYear" (BoundColumn is 1 which is
the field FiscalYear) and by selecting "Edit" buttion on form#2, the form#1
with all capital items for that fiscalyear should be braught up. My probelm
is that it does not work correctly... No matter which year I selected in
form#2, the form#1 still displays all capital items for every fiscal year. It
does not filter out the correct fiscalyear I choose
from form#2. I am attaching the related code below for your reveiw and hope
you can help me out!

Here is the code for form#2:

Private Sub cmdEdit_Click()
Dim strWhere, str As String, varItem As Variant

If Me!FiscalYear.ItemsSelected.Count > 0 Then
For Each varItem In Me!FiscalYear.ItemsSelected
str = str & Chr$(34) & Me!FiscalYear.Column(0, varItem) &
Chr$(34) & ","
Next varItem
str = Left$(str, Len(str) - 1)
If IsNothing(strWhere) Then
strWhere = "[FiscalYear] IN (" & str & ")"
Dim MyVar
MyVar = strWhere
Debug.Print MyVar
Else
strWhere = strWhere & " AND [FiscalYear] IN (" & str & ")"
End If

End If

DoCmd.OpenForm FormName:="frmApprOver50KSelect", WhereCondition:=strWhere
DoCmd.Close acForm, Me.Name
End Sub

And here is the code for form#1:

Private Sub Edit_Click()
Dim strWhere As String, varItem As Variant
If Me!lstCName.ItemsSelected.Count = 0 Then Exit Sub
' Loop through the items selected collection
For Each varItem In Me!lstCName.ItemsSelected
' Grab the Project# column for each selected item
strWhere = strWhere & Chr$(34) & Me!lstCName.Column(0, varItem) &
Chr$(34) & ","
Next varItem
' Throw away the extra comma on the "IN" string
strWhere = Left$(strWhere, Len(strWhere) - 1)
' Open the project form filtered on the selected projects
gstrWhereClub = "[Project#] IN (" & strWhere & ")"
DoCmd.OpenForm FormName:="frmApprOver50KProjects",
WhereCondition:=gstrWhereClub
Dim MyVar
MyVar = gstrWhereClub
Debug.Print MyVar
' Hide the New button, but show the Show All button
Forms!frmApprOver50KProjects!cmdAddNew.Visible = False
Forms!frmApprOver50KProjects!cmdShowAll.Visible = True
DoCmd.Close acForm, Me.Name
End Sub

Would you please let me know why it happens this way? really appreciate it!!!

Many Thanks!

Ally
 
Top