Results 1 to 6 of 6
  1. #1
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,919

    =Sum expression in report footing shows #Error

    I don't know what's causing an error in a SUM function expression in the footing section of a report, unless the expression reference is not a table field but rather a calculated field by the RecordSource query?



    Click image for larger version. 

Name:	002.jpg 
Views:	9 
Size:	63.7 KB 
ID:	25998

    As you see in the query below, "SumOfDebit" is a calculated field defined in the query.

    Code:
    SELECT CategoryName, Sum(Debit) AS SumOfDebit
    FROM tblCategories INNER JOIN tblRegister ON tblCategories.CatID = tblRegister.CatID
    WHERE (((TDate) >= #1/1/2016# And (TDate) <= #10/2/2016#))
    GROUP BY CategoryName, tblRegister.CatID
    HAVING (((tblRegister.CatID)>0));

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    Perhaps the header or footer that your control resides does not have the field SumOfDebit available to it at the time said header/footer is formatted.

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Is it in the page footer rather than a group or report footer? Won't work in the page footer.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,919
    Text box was mistakenly bound. One cannot assign a value to a bound text box. But yes, the text box was located in the report footer and the assignment code was in the footer's OnFormat event.

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    You shouldn't have needed code, the expression should work.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,919
    Yes, I believe it should work as well. I even added a textbox in the footer section bound to SumOfDebit in response to ItsMe's suggestion, but the error persisted. Having found a way around whatever kind of anomaly I've stumbled upon with a couple of lines of code I moved on.

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

Similar Threads

  1. Syntax error only shows when loading report
    By Reginald in forum Programming
    Replies: 18
    Last Post: 03-25-2016, 05:33 PM
  2. Replies: 3
    Last Post: 02-21-2016, 05:44 PM
  3. Replies: 5
    Last Post: 07-15-2015, 01:30 PM
  4. Replies: 5
    Last Post: 03-13-2012, 11:53 AM
  5. Replies: 1
    Last Post: 07-15-2011, 10:59 PM

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