none
Count Total Records on an Access Report

    Question

  • I’m sorry to post this question.  How the heck do you count total records, from a table, in a report?

    I’ve tried this:

    =Count(*)

    I get 5 (actual answer is 25665)

     

      I’ve tried this:

    =Count([LEAD FROM]), which is the field I am counting on

    I get 5 (actual answer is 25665)

     

    The TextBox is in the Report Footer.  I did this just yesterday, and it worked perfectly fine (everything was the same as now, but it actually worked). 

     

    Again, sorry to post something so simple, but it doesn’t many ANY sense at all.  Maybe because it’s 3:30AM.  Don’t know . . .  

    Saturday, September 18, 2010 7:13 AM

Answers

  • Check the report's RecordSource property.  Is the RecordSource a query that restricts records from 25665 to 5?

    Check the report's Filter and Filter On properties.  Have you restricted records?

    • Marked as answer by ryguy72 Thursday, September 23, 2010 5:04 AM
    Saturday, September 18, 2010 9:18 AM

All replies

  • Check the report's RecordSource property.  Is the RecordSource a query that restricts records from 25665 to 5?

    Check the report's Filter and Filter On properties.  Have you restricted records?

    • Marked as answer by ryguy72 Thursday, September 23, 2010 5:04 AM
    Saturday, September 18, 2010 9:18 AM
  • Ah, the RecordSource was a query (it had to be).  I just had to fully qualify the path to the field that's being counted.  This worked for me:

    =DCount("*","[TableName]","[FieldName]")

    Saturday, September 18, 2010 1:38 PM
  •  

    ryguy72,

    The way I was taught to do the count using the Record Count property was to .MoveLast then get the count and then .MoveFirst.   Here is a sample code:

    '   Count the number of members to be renewed.

        Set db = CurrentDb()
        Set rs = db.OpenRecordset("qrytblRenewOffer")
        rs.MoveLast
        lngRcdCt = rs.RecordCount
        rs.Close
        Set rs = Nothing
        Set db = Nothing

    The record count property is not initially set to the number of records.  You have to force the pointer to the end of the table, which updates the record count, and then you move it back to the first so you can process your data.  Strange I know, but that is the Microsoft way.

    Good luck

    Dennis

    Saturday, September 18, 2010 3:12 PM
  • In a report, Count is dependant of the SECTION into which it is, kind of DCount which includes the actual group, as example, for filter, so I suspect your Count was not in a section spanning the whole report, but just a part of it (where the 'group' has only 5 records).
    Wednesday, September 22, 2010 7:42 PM
    Moderator