Count the number of records in a form?

A

Anders Berlin

I have form which I may or may not have applied a filter on.
In a code related to the form, I need to know how many records are available
currently in the form (after any filtering).
How do I do this?
 
A

Allen Browne

Check the RecordCount of the form's RecordsetClone.

The count reflects the number of records loaded so far, so you need to
MoveLast to get an accurate count:

With Me.RecordsetClone
.MoveLast
MsgBox .RecordCount & " record(s)."
End With
 
A

Anders Berlin

Thanks! It worked fine but I really thought there would be an easier way! :)
 

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