473,385 Members | 1,468 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Summing values in a form inc NULL VALUES?

50
Hi guys hope you can help

I have a text box for each day of the week in a form and numbers are entered into them (but sometimes they need to be left blank i.e. not 0). I am summing these values for a total in the footer and get an error (it works if there is a number in each txt box but I some need to be left blank)....

I have tried the control source of the total in the footer to be...

=Sum([StdMon]+[StdTue]+[StdWed]+[StdThu]+[StdFri]+[StdSat]+[StdSun])

...this gives an error.

=[StdMon]+[StdTue]+[StdWed]+[StdThu]+[StdFri]+[StdSat]+[StdSun]

...this works if a number is in each text box (not possible)

OllyJ
Apr 30 '08 #1
3 2408
rsmccli
52
Hi guys hope you can help

I have a text box for each day of the week in a form and numbers are entered into them (but sometimes they need to be left blank i.e. not 0). I am summing these values for a total in the footer and get an error (it works if there is a number in each txt box but I some need to be left blank)....

I have tried the control source of the total in the footer to be...

=Sum([StdMon]+[StdTue]+[StdWed]+[StdThu]+[StdFri]+[StdSat]+[StdSun])

...this gives an error.

=[StdMon]+[StdTue]+[StdWed]+[StdThu]+[StdFri]+[StdSat]+[StdSun]

...this works if a number is in each text box (not possible)

OllyJ
I think you could get this to work by converting any values that may be null to 0 like

Nz([StdFri], 0)+Nz([StdSat], 0)+Nz([StdSun], 0) etc.

so if any of the values happen to be null they will be converted to 0, otherwise they will be left alone.

hth
rsmccli
Apr 30 '08 #2
OllyJ
50
worked a treat thanks
Apr 30 '08 #3
NeoPa
32,556 Expert Mod 16PB
Indeed it does :) Nice answer.

You may even get away with the version omitting the default val.
Expand|Select|Wrap|Line Numbers
  1. Nz([StdFri]) + Nz([StdSat]) + Nz([StdSun]) etc.
May 1 '08 #4

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

Similar topics

9
by: Yaroslav Bulatov | last post by:
I made an array of 10 million floats timed how long it takes to sum the elements, here's what I got (millis): gcc -O2: 21 Python with numarray: 104 Python with Numeric: 302...
2
by: Targa | last post by:
<input NAME="TAXRATE" onBlur="this.form.TAX.value = (this.form.TAXRATE.value - 0) * (this.form.ITEM1TOTAL.value - 0) + (this.form.ITEM2TOTAL.value - 0) " Size="4"> In my TAX field I get...
2
by: MrL8Knight | last post by:
I am building a simple shopping cart and I am having problems trying to add the costs of the items to generate a total cost. I am new at this so forgive me if my technical verbiage isn’t the...
12
by: neeraj | last post by:
Hi Can any body give me the syntax for summing the elements of the an array , without looping thanks
4
by: dancole42 | last post by:
So I have an invoicing database based on two main forms: Orders and OrderLines. Orders has fields like: OrderID BillingMethod OrderDate CreditCard CCExp OrdSubTotal ShippingCharge
2
by: JHNielson | last post by:
I Know I've posted an Urgent message before. But I'm in the middle of system testing, and these little stupid bugs are killing me...... I have a query that checks that a set of values (the...
7
by: lethek39 | last post by:
Hey I have been trying to figure out how to sum rows and columns in a matrix square. I also have been trying to get the program to list the numbers of the diagonal in the matrix. So far this is the...
10
by: Toby Gallier | last post by:
Hello! I have a form that is calculating averages as follows: " =(NZ()+Nz()+Nz())/3 " However I need to now adjust for null values , so for example if value2 is null I would then need to...
6
by: sillyr | last post by:
I have a form where I would like to include a text box that shows the sum of values entered into the form. The form collects information about length by having fields with separate centimeter...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.