record count

  • Thread starter Thread starter tracey`
  • Start date Start date
T

tracey`

How can I determin programmatically through code, how many
records are in a form. Recordset.count is not working. As
the form gets filtered, record count changes. How do I
capture the record count?
 
Tracey,

The number of records in a form is always the number of records in the
underlying recordset. If you filter the recordset and the number of records
decreases, everything is working correctly and the number of records in the form
is the number of records in the filtered recordset.
 
What would the code be to retrieve the recordset count? I
have tried:
me.recordset.count
me.recordcount
etc
and have not found a solution yet. I'm sure that its
simple however its driving me nuts!!

Thanks
 
Add a textbox named NumOfRecords on your form. Put the following code in the
OnCurrent event of the form:

Dim Rst As DAO.Recordset
Set Rst = Me.RecordsetClone
Rst.MoveLast
Me!NumOfRecords = Rst.RecordCount
Rst.Close
Set Rst = Nothing
 
I think you can just use:
Me.RecordsetClone.RecordCount
without having to move to the last record.
 
Back
Top