Getting the Record Count of a Subform

  • Thread starter Thread starter David C. Holley
  • Start date Start date
D

David C. Holley

What is the easist way to obtain the number of records in a subform? I
need to display this information as apart of the main form and use the
value for some calculations.

David H
 
Try:
[Sub1].Form.RecordsetClone

That returns the number of records loaded so far, i.e. you have to MoveLast
before you can be sure it is the right count.
 
In the design mode of the subform, click on view and click on page
header/footer.

In the page footer, create a new unbound text box with the field you want to
calculate (example: =sum([fldAmount]). Save the subform

Go to the main form in the design mode and create a new text box that points
to that field in the subform (example:
forms!mainform.form!subform!fldAmount.

That should do it.

T Martin
 
David said:
What is the easist way to obtain the number of records in a subform? I
need to display this information as apart of the main form and use the
value for some calculations.


Allen's answer was a little brief ;-)

Here's some more details:

With subformcontrol.Form.RecordsetClone
If .RecordCount > 0 Then .MoveLast
Me.yourtextbox = .RecordCount
End With
 
Back
Top