refer to recordcount of subform

  • Thread starter Thread starter geebee
  • Start date Start date
G

geebee

Hi,

I would like to refer to the recordcount of a subform. I
have the following, but it is resulting in an error
message:

If Forms![fy02
basetable2].TDY_notifier.RecordsetClone.RecordCount >= 1
Then

How can I fix this?


Thanks in advance,
geebee
 
Is TDY_notifier the name of the subform control? That is what needs to be there.
The name of the subform control should also be followed by "Form". The generic
statement looks like:

Forms!NameOfYourForm!NameOfSubformControl.Form.RecordsetClone.RecordCount

Or

Me!NameOfSubformControl.Form.RecordsetClone.RecordCount
 
geebee said:
Hi,

I would like to refer to the recordcount of a subform. I
have the following, but it is resulting in an error
message:

If Forms![fy02
basetable2].TDY_notifier.RecordsetClone.RecordCount >= 1
Then

How can I fix this?

I gather that "TDY_notifier" is the name of the subform control? Note
that it must be the name of the subform *control* on the main form,
which may or may not be the name of the form object displayed in that
control.

Assuming all that is correct, you need to refer to the Form property of
the subform control:

If Forms![fy02
basetable2].TDY_notifier.Form.RecordsetClone.RecordCount >= 1 Then

By the way, the name of your form, "fy02 basetable2", suggests that you
are embedding data -- "fy02" -- in the names of your objects. This can
make your database very cumbersome to work with. It's generally better
to have (for example) a field in a table for storing the fiscal year,
rather than having a separate table for each fiscal year.
 
geebee said:
I would like to refer to the recordcount of a subform. I
have the following, but it is resulting in an error
message:

If Forms![fy02
basetable2].TDY_notifier.RecordsetClone.RecordCount >= 1
Then

You need to go throught the subform control's Form property:

TDY_notifier.FORM.RecordsetClone.RecordCount
 
Back
Top