Re: How to obtain a count of subform records

Tech-Archive recommends: Fix windows errors by optimizing your registry



Roy wrote:
I have a main form titled "frmProcessTransactions"(the one side). Within that
form, I have an embedded subform titled "qryBRProjectAuthorizations subform".
I need to know how I can get a count of the number of records in the subform
so that I can walk through the subform records to the end without going over
and causing an error.

Can anyone help me? Please.
--
Roy

Another way to do this does not require coding at all.

Put a textbox control in the subform's footer and name this control
txtRecordsCount
Under txtRecordsCount properties ***, enter: =Count([MyId]). MyId is
supposed to be the name of the field used to bind the main form and the
subform each other.

On the main form, put another textbox and enter: =[Forms]![Main
Form]![Subform]![txtRecordsCount] in its controlsource

Is almost the same as John's solution. Keep in mind that one of the
most important things in Access is to use collections of objects.
Almost everything is collection based. If you know that well you should
also know how to reffer to an member of a specific collection from
everywhere.

Dragos

.


Quantcast