Results 1 to 3 of 3

Thread: Recordcount

  1. #1
    Join Date
    Sep 2005
    Posts
    313

    Unanswered: Recordcount

    Hi,
    In MS Access table, I have a question,

    I have a table "Hist", I open it and see the no. of records, it is 35149 records.

    But, I write the VBA,
    Dim db As DAO.Database
    Dim rs As DAO.Recordset
    Set db = CurrentDb
    Set rs = db.OpenRecordset("Hist")

    msgbox rs.recordcount

    it shows 70298 records. Why the no of the records is different? What's wrong with it?
    Please let me know, thanks.

  2. #2
    Join Date
    Mar 2004
    Location
    belgium
    Posts
    290
    you could add rs.movelast, but do also see the helpfile of msaccess, because recordcount does not always gives the exact number of records

  3. #3
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    Try this in VBA

    Dim db As DAO.Database
    Dim rs As DAO.Recordset
    Set db = CurrentDb
    Set rs = db.OpenRecordset("Hist")
    rs.MoveLast
    rs.MoveFirst

    msgbox rs.recordcount

Posting Permissions

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