Results 1 to 6 of 6
  1. #1
    4 Star Lounger
    Join Date
    Feb 2006
    Posts
    504
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Sum in query (2000)

    Edited by HansV

    Hi,

    I have a query with field A & field B. Both fields have the numbers. I try to add filed C have the total number of A & B. So I create a new column and put the following codes:

    C: Sum([A], <!t>[B])

    Then I got the error message: The expression you entered has a function containing the wrong number of arguments.

    Please advice!

    Thanks

    Regards

  2. #2
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Sum in query (2000)

    Edited by HansV

    If you want C to be the sum of A and B put this:

    C: [A] + <!t>[B]

    This is adding the value of A and B within the same record. Is that what you want?
    Regards
    John



  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Sum in query (2000)

    Notes:

    1) Sum adds values across the records of a query, not across fields. Hence John's suggestion.

    2) If you write <!t>[B]<!/t> in the Lounge, it is interpreted as the Bold tag. To get <!t>[B], use <!t>[t]<!/t>B<!t>[/t]<!/t>

  4. #4
    4 Star Lounger
    Join Date
    Feb 2006
    Posts
    504
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Sum in query (2000)

    Edited by HansV

    Thanks for all advice. However, I tried what John's suggestion and it isn't what I want.

    If Field A has record is 5 and field B has record 5, then I put C: [A] + <!t>[B] in a new column. I will get 55 in field C. But I want field C is 10 which is 5+5.

    Thanks

    Regards

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Sum in query (2000)

    Please pay attention. You ignored my suggestion how you can include <!t>[B] in a post without turning text bold.

    If 5+5 results in 55, at least one of the fields must be a text field. If you want to perform calculations, you should use number fields.

  6. #6
    4 Star Lounger
    Join Date
    Feb 2006
    Posts
    504
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Sum in query (2000)

    Thank you so much, Hans.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •