record count

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?
 
P

PC Datasheet

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.
 
G

Guest

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
 
P

PC Datasheet

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
 
T

Treebeard

I think you can just use:
Me.RecordsetClone.RecordCount
without having to move to the last record.
 

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