Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2007
    Posts
    214

    Question Unanswered: Record count issue

    I have a lable that shows number of records on my form using the code below. The issue I'm having and can't figure out is when I display all records, or search for certain criteria, the label always reads "Record 1 of 1" until I click the next button. Once I click next then it will show "Record 1 of 3" depending how many records match the results. I need this to read the number of rercords correctly without clicking next. Any suggestions.

    On Current

    With Me.Recordset



    Me.lblNavigate.Caption = "Record " & _
    Me.CurrentRecord & " of " _
    & Me.Recordset.recordcount & ""





    End With

  2. #2
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    When you first load the Form, or do something to change the number of records (by filtering, for instance) you need to force Access to load all of the Records before you can get an accurate record count. You can do this by moving to the Last Record then back to the First Record in the RecordSet:

    DoCmd.GoToRecord , , acLast
    DoCmd.GoToRecord , , acFirst


    Linq ;0)>
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  3. #3
    Join Date
    Oct 2007
    Posts
    214
    where would this code go? Thanks

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    Quote Originally Posted by benz1984 View Post
    where would this code go? Thanks
    As Missinglinq says When you first load the Form. so that would be after the form loads, probably in the forms on open event
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •