473,320 Members | 1,719 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,320 software developers and data experts.

Help with summing values on a form

37
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 values. The values recorded are selected from a lookup list so the form basically looks like
10: (which is the field) then a lookup list with numbers ranging from 0 to 100.
the fields go from 10 to 129
I tired to add up all the values by creating an unbound text box in the design view of the form then putting
=[(SIZE_CM10)+(SIZE-CM11)+(SIZE-CM12)+(SIZE-CM13)]
in the box. I also tried using Sum. When I return to the form view the text box shows all the values selected, but does not added them together. So if SIZE_CM10 has 1 value and SIZE_CM11 has 3 values it doesn't display 4 it shows 13. This is my first time using Access. Thanks for any help.
Oct 25 '07 #1
6 1232
nico5038
3,080 Expert 2GB
It's "tricky" to use a special character like "-" in a field name when using A2003.
Your controlsource is almost OK, but needs some additional "work"
Expand|Select|Wrap|Line Numbers
  1. =Val(NZ([SIZE_CM10]))+Val(NZ([SIZE-CM11]))+Val(NZ([SIZE-CM12]))+Val(NZ([SIZE-CM13])) 
  2.  
The NZ() is used for when the field(s) hold nothing (Null). And the Val() forces Access to use the contents as a number.

Nic;o)
Oct 27 '07 #2
sillyr
37
Thanks for the help. I tried typing in the script,but now I get an error message: You may have typed an operand without an operator. Also I had a typo the - should be _ so all field names are SIZE_CM10 or whatever number is next. Thanks for your help.
Oct 28 '07 #3
nico5038
3,080 Expert 2GB
Can you post the line giving the error ?
Didi you check or all fieldnames used are the names in the Properties tab Other.

Nic;o)
Oct 28 '07 #4
sillyr
37
Hi- I retyped in the code and did not get the same error message this time, but on the form view of the form in the unbound text box there is #Name? and no calculation is done. I did check the field names are correct. The field is part of a combo box. I don't know if this makes a difference. Thanks

=Val(NZ([SIZE_CM10]))+Val(NZ([SIZE_CM11]))+Val(NZ([SIZE_CM12]))+Val(NZ([SIZE-CM13]))
Oct 31 '07 #5
nico5038
3,080 Expert 2GB
Sure all hyphens are underscores? Check: Val(NZ([SIZE-CM13])).....

Somewhere a name is in error c.q. not the same as in the controlsource of the form.

Nic;o)
Oct 31 '07 #6
sillyr
37
Thanks for your help. Everything is working great.
Nov 6 '07 #7

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: SunMan | last post by:
Hello! I am trying to create a program that will ask for a user to enter a series of letters (codes) and then print out a table that shows the codes in decending frequency. Only letters will be...
28
by: stu_gots | last post by:
I have been losing sleep over this puzzle, and I'm convinced my train of thought is heading in the wrong direction. It is difficult to explain my circumstances, so I will present an identical...
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...
3
by: Kitana907 | last post by:
Hi- I am having issues with adding up fields in a subform. I have a form that has a subform in datasheet mode. It lists titles of books with their correlating units and dollar amount . 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
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...
3
by: dbProject | last post by:
Thanks for reading...I need all the suggestions I can get. Access 2000 db. We have project with 10 categories - each with their own set of criteria (txt or values that need to be met by...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.