Results 1 to 10 of 10
  1. #1
    hithere is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Sep 2011
    Posts
    63

    DCount in footer

    Is it possible to have DCount field count specific records in a report footer? I am working with a report that shows how many orders have been fulfilled. I have a DCount filed that shows how many orders have been made so I can calculate a fulfillment percentage in the reprot header.



    I have a report footer that groups by fulfillment date (month). I would like to place the DCount in the footer as well to show the stats by month. I copied the DCount textbox from the report header but it is giving me the exact same info in the footer as the header.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    What do you mean you have a DCount field - this is a calculated field in a query?

    Report footers don't do grouping, need Group Section for that. Doesn't matter if the textbox is in report header or report footer, the data is the same.

    Want to provide db for analysis? Follow instructions at bottom of my 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.

  3. #3
    hithere is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Sep 2011
    Posts
    63
    Sorry for the late response. I had to focus my attention on another project.

    The report I have displays how many orders have been shipped by the selected Company and dates in the Sales by Company Dialog form.

    What I would also like to show is how many orders there are in total to produce a percentage. I have two highlighted fields in my report that I am having trouble with, which are DCounts. What I would like the first Dcount to do is to display from the Order Info query how many orders there were for the selected Company in the Sales by Company Dialog form.

    In the second text box I would like the info from the first DCount text box broken down by month...i.e. how many orders there were for the selected company in the Sales by Company Dialog form that occured within that month. I am having difficulty getting either of these two fields to work correctly. I have attached my db for analysis.
    Attached Files Attached Files

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    Try:

    Orders Placed: =Count(*)

    Orders Shipped: =Sum(IIf(Not IsNull([ShippedDate]),1,0))

    Might want to add two graphic lines at bottom of OrderDate footer so it will better define the groups.

    You posted db with actual addresses & phone numbers? Might want to remove the file from 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.

  5. #5
    hithere is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Sep 2011
    Posts
    63
    Hi June 7,

    I tried your suggestion and Orders Placed and Orders Shipped turn out to be the exact same number all the time when there are several orders that have not been shipped. In which case there will be more orders for a product than there are shipped.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    That does make sense. Do you expect something else?
    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.

  7. #7
    hithere is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Sep 2011
    Posts
    63
    In the report the orders placed and orders shipped are always equal. While this may be true in some instances, the number of orders should generally be more than than the orders shipped. I'm not sure why they always come up equal.

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    That is because the Sales By Company report (titled: Ship Report from ... - ...) RecordSource is a query retrieving only OrderDetails records with a ShipID. The Count and Sum expressions are based on records in the report. If you want something else then modify the RecordSource or the calculations. For Orders placed, would need a DCount that has the same date range and company criteria as the report's RecordSource.
    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.

  9. #9
    hithere is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Sep 2011
    Posts
    63
    Ahhh....duh...that makes sense. Having the record souce include all orders (whether shipped or not will properly display the results). However, I need the report to be limited to only those orders that have been shipped but somehow pull a field that calculates how many orders have been made for that item within the specified time frame....and then breaking it down by month in the group footer. I think what I am trying to accomplish may not be possible since the dcount order field won't be assoicated with the control source of the report.

  10. #10
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    The OrderInfo query won't work for order counts because it has order detail records.

    Really should include the CustomerID field in Ship Report query and do filter on that field. Make CustomerID the BoundColumn of combobox. Could also include OrderID in the query.

    Calculate two fields in Ship Report query:
    Start: [Forms]![Sales By Company Dialog]![StartDate]
    End: [Forms]![Sales By Company Dialog]![EndDate] (Odd, this calc doesn't show up in query, but the value is available to report)
    Then instead of referring to the form controls in textboxes on report, can refer to the constructed fields.

    Report Header orders placed calc: =DCount("[OrderID]", "Orders", "[CustomerID] ='" & [CustomerID] & "' AND [OrderDate] BETWEEN #" & [Start] & "# AND # " & [End] & "#")

    Right now the only group in the report is grouping on OrderDate, not month. If you want monthly instead then Group By on Expression: Month([OrderDate]). Like the Start and End field calcs, this month calc could also be done in query and that constructed field used as the Grouping criteria and in the Group DCount calc shown below.

    Place a textbox (can be hidden) named tbxMonth in the Group section: =Month([OrderDate]).
    Group Footer orders placed calc: =DCount("[OrderID]", "Orders", "[CustomerID] ='" & [CustomerID] & "' AND [OrderDate] BETWEEN #" & [Start] & "# AND # " & [End] & "# AND Month([OrderDate])=" & [tbxMonth])

    BTW, I NEVER build lookups in tables. When I view tables I want to see the real values. http://access.mvps.org/access/lookupfields.htm
    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. Sum in Form footer
    By NISMOJim in forum Forms
    Replies: 3
    Last Post: 01-17-2011, 09:11 AM
  2. Footer Totals
    By allenjasonbrown@gmail.com in forum Reports
    Replies: 3
    Last Post: 09-30-2010, 09:40 AM
  3. Page Footer
    By jamil_kwi in forum Access
    Replies: 1
    Last Post: 05-31-2010, 04:02 AM
  4. sum in form footer
    By dean in forum Access
    Replies: 1
    Last Post: 09-11-2009, 02:35 AM
  5. Page Footer Top
    By RHall in forum Reports
    Replies: 3
    Last Post: 12-15-2005, 09:35 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