Results 1 to 4 of 4
  1. #1
    Psyclone is offline Novice
    Windows XP Access 2003
    Join Date
    Mar 2011
    Posts
    7

    Query with null values

    I haven't used Access in about 5 years and am having trouble with queries. I've tried reading tutorials, but they weren't much help for what I'm trying to do.

    I have several tables for a sporting event. I want to calculate the total scores from each event (table) in the query. Here's what my tables look like...




    TOURNAMENT 1 (Table 1)

    PlayerName........Round 1.........Round 2.........Round 3.........Total
    John................27..............26............ ..28..............81
    Paul................32..............28............ ..24..............84
    George..............29..............27............ ..30..............86
    Pete................36..............35............ ..33.............104

    ----------------------------------------------------------

    TOURNAMENT 2 (Table 2)

    PlayerName........Round 1.........Round 2.........Round 3.........Total
    Paul.................25..............27..............24.............76
    John
    .................29..............28..............26.............83
    George
    ...............26..............30..............28.............84
    Ringo
    ................27..............30..............29.............86

    -----------------------------------------------------------------------------

    I'm trying to set up my query to sum the totals from each event.
    Right now, I just have an expression (Total 1 + Total 2) that gives me the totals for each event and it looks like this when I execute it...

    QUERY

    PlayerName........Event 1.........Event 2
    Paul
    .................81..............83
    John
    .................84..............76
    George
    ...............86..............84
    Ringo................................86

    Pete................104

    ----------------------------------------------------------
    ---------------------

    The player totals are showing even when they don't play in all events. When I add another field to the query with the expression "Grand Total: Event 1 + Event 2", it only adds the events if a player played in all of them and ends up looking like this when I execute it...

    QUERY

    PlayerName.......Grand Total
    Paul.................164
    John.................160
    George...............170


    ----------------------------------------------------------


    It isn't totaling the players who didn't play in every event. How do I get it to sum all the totals if someone is missing from a table?

    Is the problem that it's trying to sum a Null value from the query fields?

  2. #2
    HiTechCoach's Avatar
    HiTechCoach is offline MS MVP - Access Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Jul 2010
    Location
    Oklahoma, USA
    Posts
    705
    It would help to know all the table and all the fields in each table.

    Do you have a players table?
    Boyd Trimmell aka Hitechcoach
    Database Architect and Problem Solver
    Microsoft MVP - Access Expert
    25+ years specializing in Accounting, Inventory, and CRM systems
    "If technology doesn't work for people, then it doesn't work."

  3. #3
    Psyclone is offline Novice
    Windows XP Access 2003
    Join Date
    Mar 2011
    Posts
    7
    I got it. As soon as I found it, I remember using it before. I just had to use Nz(expr) to deal with the values.

    Sorry, I honestly spent the last day or two searching (not continuously) for this answer and refamiliarizing myself with Access. Of course I found the answer about an hour after I posted this.

    How do I set this thread as solved?

    And yes, I have a players table that I was using too.

  4. #4
    HiTechCoach's Avatar
    HiTechCoach is offline MS MVP - Access Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Jul 2010
    Location
    Oklahoma, USA
    Posts
    705
    Thanks for the update.

    Great job on getting it figured out.
    Boyd Trimmell aka Hitechcoach
    Database Architect and Problem Solver
    Microsoft MVP - Access Expert
    25+ years specializing in Accounting, Inventory, and CRM systems
    "If technology doesn't work for people, then it doesn't work."

Please reply to this thread with any new information or opinions.

Similar Threads

  1. null values
    By ippy in forum Queries
    Replies: 3
    Last Post: 12-20-2010, 10:39 AM
  2. Excluding null values on SQL table query
    By DB2010MN26 in forum Queries
    Replies: 1
    Last Post: 09-03-2010, 12:54 PM
  3. Null Values in query
    By LesleaOH in forum Queries
    Replies: 0
    Last Post: 10-19-2009, 04:45 PM
  4. Fill in Null values
    By Petefured in forum Queries
    Replies: 1
    Last Post: 10-06-2008, 12:54 PM
  5. Null Values not showing up in a Query
    By Valli in forum Queries
    Replies: 0
    Last Post: 01-04-2006, 03:53 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums