• Counting Records in a Report (A2K SR2)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Counting Records in a Report (A2K SR2)

    Author
    Topic
    #361678

    I have a report that has a record counter in the report footer, using the following Control Source in an unbound text box: =Count(*). The report prints out base Purchase Order information (PO number, vendor, address, phone number, etc.) as well as all the line items associated with the purchase order. My goal with the record counter is to count ONLY the number of purchase orders, not the number of line items. However, the counter returns the number of line items, which greatly exceeds the number of actual purchase orders because each purchase order contains numerous line items. I know it must be syntax problem. Please help. Thank you.

    Viewing 0 reply threads
    Author
    Replies
    • #547456

      In order to count all the Purchase Orders (not the associated Line Items), try adding a grouping level for Purchase Orders in the report. Place the Purchase Order information in the Purchase Order Group Header section and place the Count function in the Purchase Order Group Footer section. Your Detail section should contain only Line Item information.

      • #547461

        Thomas,

        The report already has a Purchase Order Group Header section (for the PO information) and a Detail section (for the line items). When I place the counter in the PO Group Footer section, the count control simply returns the number of line items associated with each purchase order.

        • #547508

          I tested the following method with 6 POs and 14 Line Items and got the correct count of 6 POs.
          In the PO Group header, place an unbound text box with the properties:
          Name RecordCount
          ControlSource =1
          RunningSum Over Group
          Visible No
          In the report footer, place an unbound text box and set the Control Source to =[RecordCount].
          HTH

          • #547640

            Thomas,

            Thank you. Your method worked perfectly. Thanks for taking the time to come up with this solution.

    Viewing 0 reply threads
    Reply To: Counting Records in a Report (A2K SR2)

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

    Your information: