recordsetcount issue

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
 
A

Allen Browne

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
 
R

Richard

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Refresh/OnCurrent Questions 3
After Update, After Insert 4
Finding Totals from two diff date ranges 5
subforms not requerying 6
subform to subform 3
problem with recordset 1
Form/Subform Refresh 3
Which is faster? 4

Top