Results 1 to 5 of 5
  1. #1
    Lounger
    Join Date
    Jan 2001
    Location
    Denver, Colorado, USA
    Posts
    39
    Thanks
    0
    Thanked 0 Times in 0 Posts

    SUM function not working for lookup field (2003)

    Problem: I have a lookup field that holds numbers (options are 0 or 1). In a query, I would like to use the SUM function to add the values. For example, if I have entered two 1's and three 0's, I would like to get back the value 2. However, when I have two 1's and three 0's, I get back the value "7". The query works find on other fields that are not look-up fields. Any help is greatly appreciated.

  2. Subscribe to our Windows Secrets Newsletter - It's Free!

    Get our unique weekly Newsletter with tips and techniques, how to's and critical updates on Windows 7, Windows 8, Windows XP, Firefox, Internet Explorer, Google, etc. Join our 480,000 subscribers!

    Excel 2013: The Missing Manual

    + Get this BONUS — free!

    Get the most of Excel! Learn about new features, basics of creating a new spreadsheet and using the infamous Ribbon in the first chapter of Excel 2013: The Missing Manual - Subscribe and download Chapter 1 for free!

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

    Re: SUM function not working for lookup field (2003)

    How exactly is the lookup field defined, and how do you enter the values - using a combo box, or ...?

  4. #3
    Lounger
    Join Date
    Jan 2001
    Location
    Denver, Colorado, USA
    Posts
    39
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: SUM function not working for lookup field (2003)

    The field I am trying to summarized is the field "altered_consciousness" in table "injury_information_tbl". The field "altered"consciousness" is a lookup field of type Long Integer. The field looks up from the column "altered_consciousness_number" in the table "altered_consciousness_lkup_tbl". The field "altered_consciousness_lkup_tbl.altered_consciousn ess_number" is defined as Long Integer type. The data is entered into injury_information_tbl.altered_consciousness by using a drop-down list.

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

    Re: SUM function not working for lookup field (2003)

    Your result makes me suspect that 0 and 1 are somehow coded as 1 and 2 (3 times 1 plus 2 times 2 equals 7). Does the altered_consciousness_lkup_tbl table have a primary key field different from altered_consciousness (for example an AutoNumber field), and does the combo box (dropdown list) have 2 columns? If so, the value stored in injury_information_tbl is the primary key. You could get around this by setting the Bound Column property of the combo box to 2. But you'd have to alter already existing values.

  6. #5
    Lounger
    Join Date
    Jan 2001
    Location
    Denver, Colorado, USA
    Posts
    39
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: SUM function not working for lookup field (2003)

    I'm gonna try that. Thanks!!

Posting Permissions

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