473,890 Members | 1,370 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Why isn't my Sum/Nz function working?

Seth Schrock
2,965 Recognized Expert Specialist
I have a report that I'm trying to build as a receipt for my customers. The important field names are ItemPrice, SalesTax, and TotalPrice. I have three textboxes that will contain the total amount for each of these fields. I'm using the following as the Control Source
Expand|Select|Wrap|Line Numbers
  1. =Nz(Sum([ItemPrice]),0)
When I open the report, the textbox just says #Error. What am I doing wrong? I tried just doing
Expand|Select|Wrap|Line Numbers
  1. =Sum(ItemPrice)
, but I get the same result. I copied this from the NorthWind sample database. I used the Expression Builder to make sure I was typing things correctly, but that didn't help. I don't know what else to try or what information I need to give to make it easier to solve.
Sep 4 '12
15 11129
5,501 Recognized Expert Moderator Expert
I know that summing calculated results will give an error... if you are trying to do page by page totals then you will need the vba and read thru the following article as it has a step by step: http://office.microsoft.com/en-us/ac...001122444.aspx
Sep 4 '12 #11
Seth Schrock
2,965 Recognized Expert Specialist
Interesting... I did't realize that the Page footer didn't support Sum() functions. I had only put it there because I wanted the total at the bottom of the page instead of at the end of the data, but I will move it and see if it changes the results.
Sep 4 '12 #12
32,584 Recognized Expert Moderator MVP
I think that's your problem Seth. Aggregation (Summing in this case) can only work across a defined group. A page is grouped by how much will fit in a certain length of space, so doesn't represent anything you can aggregate over. Essentially then you need to put the controls in the header of either a sorted group or the whole report.
Sep 4 '12 #13
5,501 Recognized Expert Moderator Expert
If I want the grand total on every page, I place a text control in the report footer/header, set the data property, set the control to visible=no. Then in the page section insert another text control... usually change the lable to "Grand Total" or what ever and then set the data sorce to be the control in the footer and you could do the same as above for group totals, in the details section, etc so that th results are at the bottom of the page.

The link I pointed to has some clever ideas...

Sep 4 '12 #14
Seth Schrock
2,965 Recognized Expert Specialist
So Simple. Nice to know this. I just cut and pasted the totals textboxes into the report footer and it worked. Thanks z and NeoPa.
Sep 4 '12 #15
32,584 Recognized Expert Moderator MVP
Z is absolutely correct, in that you can produce totals on a Page Header, but it requires working around the fact that a page is Not fundamentally a group that can be aggregated across. It helps to understand the basics even (especially) when using clever approaches that get around those fundamental limitations.
Sep 5 '12 #16

Sign in to post your reply or Sign up for a free account.

Similar topics

by: Dfenestr8 | last post by:
I started off trying to use bsddb with my standard mandrake 9 python 2.2.1 package. The shell reported back no such module. Strange, thinks I. I thought it was standard in the package, it was when I was using Windows. So I uninstalled Python, downloaded the latest python 2.3 and compiled it from source. Now when I try to import bsddb, I get this error...... >>> import bsddb
by: David Shaw | last post by:
Hi, I'm writing a fun little program to play "Petals Around the Roses" with... I need to seed my random numbers so that they won't be the same every time I run the program, but my compiler won't let me. Here's the output my compiler generated...: -- Compiler: Default compiler Executing g++.exe... g++.exe "C:\Documents and Settings\rmarkoff\Desktop\roses.cpp" -o "C:\Documents and Settings\rmarkoff\Desktop\roses.exe"
by: Sunshine | last post by:
Pretty new to javascript so please help. Why isn't this working in my validateform()? if (document.This.strOld.value.compareTo(Session("strPassword")) != 0) { alert("Current password incorrect"); return false; } If I write out Session("strPassword") the value is 'password'. What am I doing wrong?
by: Chris | last post by:
Hi, I'm stumped and could use some suggestions. I'm trying to serialize some data to an XML fragment in string form, then deserialize it from a string back to an XML fragment, from which I will rehydrate my class. I've built a little Windows forms test app to see if my approach will work. It doesn't. When I step through the code in the debugger, I see that the MemoryStream is null, and the string variable "xmlFragment" is an empty
by: interpim | last post by:
Just a quick exercise from my C programming book, that I can't figure out why it isn't working properly. It kinda works but im getting wierd output. It is supposed to remove the vowels from text. #include <ctype.h> #include <stdio.h> int isvowel(int letter); int main(void) { int letter;
by: Christina Androne | last post by:
I've read the docs and evrything seems fine. Then what I am missing ? This is the code snippet: try {
by: Dave | last post by:
I have a simple master page and it won't seem to work: <%@ Master Language="C#" AutoEventWireup="true" CodeFile="z.master.cs" Inherits="z" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:// www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server">
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.