Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

referring to a control in a subform

Status
Not open for further replies.

rewdee

Programmer
Aug 17, 2001
295
US
I think there's relatively simple answer but I can't find it yet. I'm trying to display the number of records in a subform's label as:
Code:
Me.frmsub!lblRecNum.Caption = me.frmsub.RecordsetClone.recordnumber
OR
Code:
me.frmsub!form!lblRecNum.Caption=me.frmSub!Form.RecordsetClone.RecordNumber

Anyone know how I display the number of records in a label in a subform?

Thanks,
Rewdee
 
There is no RecordNumber property anywhere in Access or DAO. Do you want the total number of records in the subform's record source? That would be:
Me!frmSub.Form!lblRecNum.Caption = Me!frmSub.Form.RecordsetClone.RecordCount

In general, when working with forms, you want to use the "!" operator before the name of a control, and the "." operator before the name of a property. "Me.frmSub" is also valid, because Access makes a special case for it, but I think you'll find that it doesn't work in certain special contexts. Rick Sprague
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top