By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,223 Members | 1,633 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,223 IT Pros & Developers. It's quick & easy.

RecordCount method

P: n/a
May be it will help someone.
I faced the strange problem with RecordCount property of cloned
Recordset within the Current event handler. The RecordCount value was
correct every time I had diagnostic message boxes turned on or when I
debugged the handler step by step. And these values became incorrect
in normal mode (to be exact they became wrong after the first
occurrence of "no records" case). I tried to use MoveFirst and
MoveLast combination, but it required the error handler for the "no
records" case. Then I tried to use EOF/BOF-based solution but these
properties behave in the same way. I solved my problem in the
following way - I just added invoke of Requery method just after
creation of recordset. For my case it looks like that:
Set rst=Me.RecordsetClone
rst.Requery ' This is the "magic" that helped
trec=rst.RecordCount
Jan 25 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
I would normally use both
------------------------------
Set rst=Me.RecordsetClone
If Not rst.EOF Then
rst.MoveLast
rst.MoveFirst
intRecCount=rst.RecordCount
End If
---------------------------
I personally prefer not to requery as it can be slow on complicated queries
and/or larger tables.
I hope this RecordCount issue was fixed in Access2007.

<qq*****@gmail.comwrote in message
news:5b**********************************@v46g2000 hsv.googlegroups.com...
May be it will help someone.
I faced the strange problem with RecordCount property of cloned
Recordset within the Current event handler. The RecordCount value was
correct every time I had diagnostic message boxes turned on or when I
debugged the handler step by step. And these values became incorrect
in normal mode (to be exact they became wrong after the first
occurrence of "no records" case). I tried to use MoveFirst and
MoveLast combination, but it required the error handler for the "no
records" case. Then I tried to use EOF/BOF-based solution but these
properties behave in the same way. I solved my problem in the
following way - I just added invoke of Requery method just after
creation of recordset. For my case it looks like that:
Set rst=Me.RecordsetClone
rst.Requery ' This is the "magic" that helped
trec=rst.RecordCount

Jan 28 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.