recourdcount acting strangely

G

Guest

Hey everyone

I have a subform to a filtered form in Access 2002 for a
2k database. The subform has an OnCurrent event that
involves calling Me.RecordsetClone.RecordCount. However,
when the form first loads, regardless of what the number
of records should be, the value of recordcount is always
1. I added me.RecordsetClone to the watch, and the
member "Recordcount" actually does give the correct value
at the time the Recordcount method is called, but the
Me.RecordsetClone.RecordCount I added to the watch always
givs the value of 1. I'm completely stumped, so any help
is greatly appreciated.

TIA

Chris
 
A

Allen Browne

The RecordCount of a DAO Recordset indicates the number of records accessed
so far. Immediately after load, this will be 0 if there are no records, or 1
if there are (since we have only loaded the first record at that point).

To force the full count, you can move to the last record in the recordset:
With Me.RecordsetClone
If .RecordCount > 0 Then
.MoveLast
MsgBox "Records: " & .RecordCount
End If
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

Top