Refresh a recordcount of subform

  • Thread starter Thread starter Warrio
  • Start date Start date
W

Warrio

Hello!

I have a tab control that contains two subforms and each of then contains a
subform again. And when I pass from a tab to another, the record count takes
about 1 sec to refresh.
When I try to get the value of the Recordcount of the child subform, I get 1
only and after 1 second, Access updates the recordcount of the subform to
the real value of the recordcount. (can be seen in the navigation toolbar).

How can I detect when Access updates the real value of my recordcount?
I can do a select count(*) of the table of my child subform, but this
solution slows down the application.

Thanks for any suggestion
 
Hi Warrio,

Are you talking about getting the recordcount via code? The recordcount
property of the recordset is a low priority property - meaning that Access
updates it when it gets around to it. If the recordset is not empty, the
recordcount will be 1 (as you've already noted). To force Access to update
the recordcount you have to navigate to the last record -

For example, using a newly opened recordset named rst:

'Make sure there are records
if not (rst.eof and rst.bof) then
rst.movelast
debug.print rst.recordcount
rst.movefirst
endif
 
Back
Top