My recordset is less than 10,000. For whatever reason it doesn't return then
correct RecordCount even though the new Recordset is correct. The reason I
need the correct RecordCount is that I have a custom navigation bar and I re-
populate WhichRecord and HowManyRecords when a filter( new RecordSource ) is
applied. Here's the orginial code:
Dim Dealer As String
Dim SQLString As String
Dim rs As New ADODB.Recordset
Dim Conn As ADODB.Connection
Me.Requery
Dealer = InputBox("Please enter the Dealer Name", "Search", "")
SQLString = "EXEC dbo.SearchDealer " & Dealer
Set Conn = CurrentProject.Connection
Set rs = New ADODB.Recordset
rs.Open SQLString, Conn, adOpenKeyset, adLockOptimistic
If Not (rs.EOF And rs.BOF) Then
Me.RecordSource = SQLString
Me.WhichRecord = Me.Recordset.Bookmark
Me.HowManyRecords = Me.Recordset.RecordCount
Else
MsgBox "No records match the criteria specified"
End If
>> I was having issues with my form not showing the correct number of records so
>> I put in a MoveLast and MoveFirst cycle before I get the recordcount and it
[quoted text clipped - 14 lines]
>Cheers
>Phil
Sylvain Lafontaine - 12 Jul 2005 19:17 GMT
Possible answer: the fetching of records are asynchronous and is not
finished when you execute the statement « Me.HowManyRecords =
Me.Recordset.RecordCount ». You should use a timer and/or poke the state of
the Recordset and wait until it has finished doing its job.
Instead of doing a second requery, you could also use the recordset rs as
the source of the form. See http://support.microsoft.com/?kbid=281998 for
more informatin.

Signature
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
> My recordset is less than 10,000. For whatever reason it doesn't return
> then
[quoted text clipped - 55 lines]
>>Cheers
>>Phil
Andrew Backer - 14 Jul 2005 01:06 GMT
Not in front of access, so I can't be sure, but ...
Have you tried using RecordsetClone?
Me.RecordsetClone.MoveFirst/Last
Me.Recordset = Me.RecordsetClone?
I know it is what I use for searching/etc and dealing with bookmarks.
Might help.
- Andrew