By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,072 Members | 1,200 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,072 IT Pros & Developers. It's quick & easy.

creat an unbound test box on a form to sum data from a simple query

P: 37
Hi - My database is using Access 2007. I created a simple query from two linked tables that sums up the data for all records for 11 different fields. Then I made a form that shows the totals for the fields that can be seen by my users. I have a request from a user to create a total for all the fields on the form.
For example the form shows
Cod and then gives the total 700
Haddock 500
Winter Flounder 300
I tried to create an unbound text box on the form to sum up the totals so that the text box would show for the example 1500.
I tried to do this with the code
Expand|Select|Wrap|Line Numbers
  1. =Val(NZ[SumOfPounds kept120]))+Val(NZ[SumOf# Kept7270]))+Val(NZ[SumOfPounds Kept 3650]))+Val(NZ[SumOfPounds Kept8009]))+Val(NZ[SumOfPounds kept1219]))+Val(NZ[SumOfPounds Kept1230]))+Val(NZ[SumOfPounds Kept1200]))+Val(NZ[SumOfPounds Kept1240]))+Val(NZ[SumOfPounds Kept1220]))+Val(NZ[SumOfPounds Kept1200]))=Val(NZ[SumOfPounds Kept1477]))+Val(NZ[SumOfPounds Kept818]))]
I get an error message of - The expression you entered contains invalid syntax. You may have entered an operand without an operator.

The query is updated every time the user enters more data for each field.
Thanks for any help.
Oct 10 '08 #1
Share this Question
Share on Google+
2 Replies


missinglinq
Expert 2.5K+
P: 3,532
I think the problem is that you repeatedly use code like this

Val(NZ[SumOfPounds kept120]))

where you should be using

Val(NZ([SumOfPounds kept120]))

i.re. you're omitting a left parens between

Val(NZ

and

[SumOfPounds kept120]


As I've said, I think you repeat this mistake, so check your code carefully.

Welcome to Bytes!

Linq ;0)>
Oct 10 '08 #2

P: 37
Thanks for your help I was missing the (
Oct 11 '08 #3

Post your reply

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