Results 1 to 4 of 4
  1. #1
    mrfixit1170 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jan 2011
    Posts
    42

    Trouble with a Select Statement


    Hello all,
    I am having some trouble figuring this little issue out. In this Select statement I am trying to total numbers from 2 queries, I have used the IIf(IsNull(),0() to capture if their is a null record, but what happens if because of the join there is no record?

    Code:
     
    SELECT qryReportAVUMSD.EI_ID, qryReportAVUMSD.MOS_ID, IIf(IsNull([qryReportAVUMSD].[SDMH]),0,([qryReportAVUMSD].
    
    
    [SDMH])+IIf(IsNull([qryReportAVUMSE].[SDMH]),0,([qryReportAVUMSE].[SDMH]))) AS TMH
    
    
    FROM qryReportAVUMSD 
    
    
    INNER JOIN qryReportAVUMSE ON (qryReportAVUMSD.EI_ID = qryReportAVUMSE.EI_ID) AND (qryReportAVUMSD.MOS_ID = 
    
    
    qryReportAVUMSE.MOS_ID)
    
    
    ORDER BY qryReportAVUMSD.EI_ID, qryReportAVUMSD.MOS_ID;
    I have some records not counted in my data set because there are no records in qryReportAVUMSE but records are in are in qryReportAVUMSD. Any help will appreciated.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    If they will be in qryReportAVUMSD, try changing INNER to LEFT.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    mrfixit1170 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jan 2011
    Posts
    42
    That did the trick......I can see the records total up. Thank you pbaldy for your suggestion.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    Happy to help.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Multi Select List Box Trouble
    By Subwind in forum Forms
    Replies: 2
    Last Post: 06-06-2012, 04:00 AM
  2. Help with Select Case statement
    By focosi in forum Access
    Replies: 4
    Last Post: 08-09-2011, 12:01 AM
  3. Need a select statement
    By gahawy in forum Queries
    Replies: 5
    Last Post: 01-15-2011, 04:02 PM
  4. select statement
    By jellybeannn in forum Access
    Replies: 5
    Last Post: 08-13-2010, 05:21 AM
  5. Select statement syntax?
    By ksmith in forum Programming
    Replies: 3
    Last Post: 06-24-2010, 09:21 AM

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