• ‘count’ function on report (2K)

    Author
    Topic
    #376616

    Help. I’ve created a simple database with one table and a couple of queries. I’m using one of the queries to create a report. I cannot for the life of me figure out how to make it do a “count” function on a particular column of the report. I don’t want a sum or anything else, just a count. Is there a place I can go to get detailed information on how to do this? Thanks, answer here or at my email address, skelmer@stlcc.edu.

    Viewing 0 reply threads
    Author
    Replies
    • #617459

      In the appropriate report section (probably the report footer), place an unbound textbox with the following formula in the Control Source: =Count([your fieldname])

      • #617461

        Well, I’m closer…now I get #error on the report instead of a blank space! I want it to count that field, but currently there is only one item in that field (from the query). I should still see something besides #error, right?

        • #617465

          Getting a Count in a Report can be a daunting task. The simple solution (if the information cooperates) is to put the following in a textbox in your Report Footer ( or whichever footer is appropriate)

          =Sum(IIf([YourFieldOnTheReport] = “WhateverValueYouWantToCount”, 1,0))

          Summing zero’s and 1’s is the same as counting.

          Paul

        • #617514

          Is there any chance that the field you are counting on contains a null value?

          • #617528

            The field is not “null,” I don’t think. It’s a text field, I just want a count of the column. If there’s four, I want it to say four, if there’s 15, I want it to say 15. I’m trying to create a report that anyone, whether they know access or not, can print off whenever they want, and it will have an accurate count of how many entries are in that column.

        • #617543

          I would think that the result would be 1. Is your fieldname and the report textbox name exactly the same? If not, try using the name of the report textbox in the Contol Source formula I posted earlier. Does that help?

          • #617553

            It works in the body of the report but not in the footer, but that solves my problem easily enough. THanks for your help!

    Viewing 0 reply threads
    Reply To: ‘count’ function on report (2K)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: