Count Records in a SubForm

  • Thread starter Thread starter Chip
  • Start date Start date
C

Chip

Hey everyone...

Struggling with some syntax here. I'm trying to Count records in a
subform. I have a textbox and have set it equal to many variations of
the following...

=[qryStudents subform1].[Form]![ID].[Form].[RecordsetClone].
[RecordCount]

Most of the examples I've seen of this take the form of

nameofsubformcontrol.Form.RecordsetClone.RecordCount

What I'm having trouble with is, my subform control's name is
qryStudents subform1. The field I'm trying is the ID field. How
would I combine that into one line, so teh syntax above would work?
Any ideas?

chip
 
Ignore the ID field. It's not part of the expression if all you need is the
count of records.

There are several problems with this approach anyway, e.g.:
a) Access has problems figuring this out if the form has no records and no
new records can be added.

b) The expression fails in Access 2007.

c) If it works, the expression may initially return 1 regardless of the
number of records present. It will update later (when the form
recalculates), but initially it may display the number of records fetched so
far (0 for none, or 1 for some.)

A simple workaround might be to set the subform's Navigation Buttons
property to Yes. You will then see the record count at the foot of the
subform, without needing to maintain your text box.
 
Back
Top