Count of records in a subform

M

Max Moor

Hi All,
I have a subform displaying a bunch of records, and I want to display
how many there are. Saying:

fsubName.Count

doesn't work. I've also tried:

fsubName.Form.Count

but it returns the number of controls on the subform. (I think I know
why... maybe) How do I get at the number of records?
 
W

Wayne Morgan

If you are trying to get this from the main form

Me.NameOfSubformControl.Form.Recordset.RecordCount

The NameOfSubformControl is the name of the control on the main form that holds the
subform, NOT the name of the subform (although, they may be the same if you just dragged
and dropped the subform onto the main form). To get the name of the subform control, open
the main form in design mode. Open the Properties sheet, then click on the subform ONE
time. The properties sheet should show the name of the subform control. If you click on
the subform a second time, you will be in the subform and the Properties sheet will show
the form's name, not the name of the control holding the form.
 
M

Max Moor

If you are trying to get this from the main form

Me.NameOfSubformControl.Form.Recordset.RecordCount


Yes! Thank you, Wayne. MVPs to the rescue again.

Max
 

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