Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't get an accurate record count!

Status
Not open for further replies.

franklin1232

IS-IT--Management
Aug 29, 2001
207
US
After opening a form with a filter I want to get the total number of records. If I step through my code I can get the right number, but with out breaks the recordcount property is = 1.

lblRecCount = me.recordsetclone.recordcount

I have put this in open load applyfilter events and nothing is working. How can I pause so that the recordcount property updates before it set the lblRecCount to it's value.
 
In Access 97, you had to do a MoveFirst and MoveLast before the RecordCount property was set. Maybe this is what is happening. There are other reasons why the record count will not get set, but would to know more about what you are doing. You could try against the form instead of the clone.
 
My problem is that the record set property no matter whether against the clone or the form isn't intilizing until after the form completely loads. Movefirst and movelast don't work because at the time of the form_open and form_load event the object is empty. I was thinking that the apply filter event might work because it seems to be the last thing to happen, but that to failed.
I need to solve and issue where the user searches for Job Numbers to update, but if they find more than one record they don't realize that are updating the wrong job number because they don't realize the filter returned more than just the first record.
 
I think I know where you are at, but not sure. It would be difficult to come up with any suggestions without knowing the logic flow with the Form. Possibly the filter could be part of opening the form. The form may need to be closed and reopened. May need to redesign the logic flow. May need to requery the form and check count after the requery. Hopefully, somebody understands better what you are doing and can provide a suggestion.
 
Hi!

Use the DCount function:

=DCount("YourIDField", "YourTableOrQuery")

Of course, you will use the table or query your form is based on.

hth
Jeff Bridgham
bridgham@purdue.edu
 
I created a recordset object set the the object equal to the form recordset did a movelast and it's working.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top