Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Display row count on continuous forms

Status
Not open for further replies.

Nittany92

MIS
May 28, 2002
10
US

For each list of items in a continuous subform, the rows are numbered from 1 to ???. When the main record changes, the associated rows in the subform are again numbered from 1 to ???.


Create a module, Module1, and define a record counter as follows:

Public RecCounter As Integer 'record counter on forms


Also in Module1, add this public function:

Private Function CountRecord()

RecCounter = RecCounter + 1
CountRecord = RecCounter

End Function



In the main form, set the counter to zero in the Form_Current event (which occurs each time the focus moves to a record) so that it resets the record count on the subform:

Private Sub Form_Current()

RecCounter = 0

End Sub



On the subform, which is defined as a continuous form, create a text box in the detail section next to the other fields and define the CONTROL SOURCE as follows:

=CStr(CountRecord()) & "."


As long as I didn't forget to document a step here, it should work just fine.

Nittany92
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top