Form.RecordSet.RecordCount

W

Warrio

Hello!

Is it possible to refresh the property RecordCount that is attached to a
form's recordset?
because in order to get the number of the recodes that are displayed in a
sub form, I'm forced to do:

Me.RecordSet.MoveLast
Me.RecordSet.MoveFirst
MsgBox Me.RecordSet.RecordCount

if I do not refresh the RecordSet, the property RecordCount will show 0,
cause it's variable of 2nd priority for Access.
So is there another way to refresh the rs other than make it go to last and
first?

Thanks for any suggestion
 
D

Dirk Goldgar

Warrio said:
Hello!

Is it possible to refresh the property RecordCount that is attached
to a form's recordset?
because in order to get the number of the recodes that are displayed
in a sub form, I'm forced to do:

Me.RecordSet.MoveLast
Me.RecordSet.MoveFirst
MsgBox Me.RecordSet.RecordCount

if I do not refresh the RecordSet, the property RecordCount will show
0, cause it's variable of 2nd priority for Access.
So is there another way to refresh the rs other than make it go to
last and first?

Thanks for any suggestion

No, but if you're concerned with the apparent movement of the form from
first record to last record and back, you can use the form's
RecordsetClone instead:

With Me.RecordsetClone
If .RecordCount <> 0 Then
.MoveLast
MsgBox .RecordCount
End If
End With
 
R

Ron Weiner

You could execute a Count(*) totals query or a DCount() with the same WHERE
criteria (including any filters that might be applied to the form at the
time) as you are using in your Forms recordset to get a count of records
independant of the forms recordset. However I doubt it is worth the
trouble.

I screen flashing is a problem you could use the Forms Recordset Clone to
get the count without any screen activity.

Ron W
 

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