recordsetcount issue

  • Thread starter Thread starter Richard
  • Start date Start date
R

Richard

Hi

I have a label on subformB, that gets its recordcount. When I set the set
the recordsource of the subform and loads it at runtime, I get only 4 or 3
when the actual count is 10 records. But when I debug, (when I do it step by
step) it gives me 10 records.

SubformA has the same thing, but it gives me the full rcordcount. How do I
overcome this?

Thanks in advance.

The code for the label goes:

Me.lblRecordcount=Me.subformB.Form.Recordset.RecordsetCount & " records
found."

Richard
 
For a dynaset type recordset, the count only shows the number of records
accessed so far.

You can force an accurate count by moving to the last record before
examining the count:

With Me.subformB.Form.RecordsetClone
.MoveLast
Me.lblRecordCount.Caption = .RecordCount & " records"
End With
 
Many thanks Allen

Works like a charm.

Richard


Allen Browne said:
For a dynaset type recordset, the count only shows the number of records
accessed so far.

You can force an accurate count by moving to the last record before
examining the count:

With Me.subformB.Form.RecordsetClone
.MoveLast
Me.lblRecordCount.Caption = .RecordCount & " records"
End With
 
Back
Top