Solved

Subform Running Sum

Posted on 1998-11-04
5
255 Views
Last Modified: 2008-02-26
I have a main form with a linked subform.
the subform is set for continueous forms. i would like to be able to number each record on the subform, just like the runningsum feature in reports. how?
0
Comment
Question by:rolo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 10

Expert Comment

by:brewdog
ID: 1967627
Can you just set up an AutoNumber field in the table the subform is based on? Even if you don't use the numbers, that's the easiest way to track the count of records.

brewdog
0
 
LVL 2

Expert Comment

by:bclark100898
ID: 1967628
Add a textbox to the subform.

set the control source of the text box
=RecNum()

Create a function in the subform called RecNum
Also, do a recalc when records are added or deleted from the subform.


This code is added to the subform.

Public Function RecNum()

    On Error GoTo NoCurrentRecord
   
    'this line fails if a new record is being inserted
    Me.RecordsetClone.Bookmark = Me.Bookmark

    RecNum = Me.RecordsetClone.AbsolutePosition + 1
   
    Exit Function

NoCurrentRecord:

End Function

Private Sub Form_AfterDelConfirm(Status As Integer)
    Me.Recalc
End Sub

Private Sub Form_AfterInsert()
    Me.Recalc
End Sub



0
 

Author Comment

by:rolo
ID: 1967629
i dont know which question brewdog was trying to answer
but bclarck's comment did the trick
0
 
LVL 3

Expert Comment

by:tcurtin
ID: 1967630
The autonumber may not be a valid representation of the number of records especially if a record is deleted or 'escaped' while being entered. If a new record is escaped and then reentered, Access's Autonumber WILL increment.
0
 
LVL 2

Accepted Solution

by:
bclark100898 earned 20 total points
ID: 1967631
I looks like I posted a Comment document earlier, not an Answer.  So, here is an Answer document.

Also, on a subform, one could get most any subset of records, in most any order.  An autoincrement indicates the order in which records are added, it does not indicate the order in which they are displayed.

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question