Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Forms Recordcount

Status
Not open for further replies.

MarkGreen

Technical User
Oct 4, 2002
40
GB
Hi, is there anyway to retrieve (in code) the number of records that are currently in the recordset of a form, after any filtering or querying has taken place. (i.e the number that is displayed next to the navigation buttons)

This has to be used from the same context as the currentrecord property is used. Recordcount is not really helpful because i dont really want to open another recordset.

The only way i can see at the moment is to move to the last record in code then check the me.currentrecord property and then move back to where you were.
However this is messy as you can see the cursor moving around on the screen.

Thanks a lot for any help.
Mark
 
I'd open a recordset, by using a copy of the filter from the main form, or by using the command that creates a suplicate of the current recordset, and then do a .movelast and a .count:

strSql = me.filter
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset(strSql)
If rst.RecordCount = 0 Then
CallCount = 0
Else
rst.MoveLast
CallCount = rst.RecordCount
End If
rst.Close
dbs.Close
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top