Getting the Record Count of a Subform

  • Thread starter David C. Holley
  • 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
 
A

Allen Browne

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.
 
T

T Martin

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
 
M

Marshall Barton

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top