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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sillyr
    New Member
    • Oct 2007
    • 37

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

    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
    Code:
    =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.
  • missinglinq
    Recognized Expert Specialist
    • Nov 2006
    • 3533

    #2
    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)>

    Comment

    • sillyr
      New Member
      • Oct 2007
      • 37

      #3
      Thanks for your help I was missing the (

      Comment

      Working...