Results 1 to 4 of 4
  1. #1
    FormerJarHead is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Posts
    52

    Specific Record Count

    Hi all,



    I have what I thought was a simple problem. I have a report based on a select query. Everything is working as it should as far as the results I'm getting. What the query returns is an order ID in one field and then in another field it displays the details for that order and there are a few other fields that do not pertain to the problem. Very basic query. What I would like to do is get a total for the number of orders and the number of details, i.e. 17 Orders with 117 records. I prefer to display them at the bottom of the report so what I've done is in the form footer I've created 2 unbound text boxes. In one, I've entered =Count([OrderID]). In the other =Count([Description]). The second one works...and it works so well that it also including the same results in the OrderID box.

    Is there a way in a query expression or in the control source that I can count just the orderID so when the reader of the report looks at the data, at the bottom is will give a synopsis of the number of orders and the number of details?

    Thank you for any suggestions

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    It doesn't matter which field you reference in the Count function, it will count all records of the report.

    Options for count of the orders:

    1. report/subreport arrangement and each can have their own count calcs

    2. DCount() expression to count orders, the DCount() references the Orders table, not the report

    3. An aggregate query that counts the orders and that query is included by join in the report RecordSource, this can be a nested subquery

    Options 2 and 3 will have to replicate the filter/grouping criteria used in the final report output.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    FormerJarHead is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Posts
    52
    Thanks June7. No access to db today but will give option 3 a shot on Monday. Option 1 and 2 do work but the DCount function counted every detail in the entire db, and Option one returned the same count as the details count within the date range.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    Then you must not have included filter criteria in the DCount. See last line of my previous post.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Count of specific number
    By samirmehta19 in forum Access
    Replies: 3
    Last Post: 05-20-2013, 02:29 PM
  2. Replies: 1
    Last Post: 04-04-2013, 11:59 AM
  3. Replies: 1
    Last Post: 01-24-2013, 05:50 PM
  4. Replies: 12
    Last Post: 08-21-2012, 02:40 PM
  5. Count of field based on specific values
    By tazzmann67 in forum Access
    Replies: 2
    Last Post: 03-30-2011, 09:11 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums