Counting the number of results from a query

Banaticus

Registered User.
Local time
Today, 06:32
Joined
Jan 23, 2006
Messages
153
Dim junkVar as String
junkVar = Nz(Me.Names_Combo_Box.ListCount)
The above code sets up a combo box's slider nicely. Otherwise, the slider is really jumpy and can only slide short distances.

I have a query that is the basis for a subform of a subform. The query pulls information from a main table and sets up that subsubform, but the vertical slider on that subsubform is jumpy just like the slider on a large combo box. How can I force the subform to give me the maximum number of results, so that I can be sure that it's counted things so that the slider will slide smoothly?
 
Have you tried:
Code:
If Me.RecordSet.RecordCount > 0 Then
   Me.RecordSetClone.MoveLast
   Me.RecordSetClone.MoveFirst
End If
In the OnLoad event of the SubSubForm?
 
No, it didn't make a difference if I put that into Form_Load or Form_Current.
bars.jpg

The left bar is the bar immediately upon the subform loading, the right bar is the bar after clicking into the subform.

Looking at Me.RecordSetClone.MoveFirst, it looks like it makes a clone of the recordset then moves to the first record in the clone -- without actually doing anything with the real recordset. I tried Me.RecordSet.MoveFirst followed by .MoveLast, but that made the subsubform go crazy blinking for about a second after loading every time. The slider bar was set nicely after it stopped blinking, though.
Once the last record has been accessed, the RecordCount property indicates the total number of undeleted records in the Recordset or TableDef object. To force the last record to be accessed, use the MoveLast method on the Recordset object ... Using the MoveLast method to populate a newly opened Recordset negatively impacts performance. Unless it is necessary to have an accurate RecordCount as soon as you open a Recordset, it's better to wait until you populate the Recordset with other portions of code before checking the RecordCount property.
Darn.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom