Results 1 to 3 of 3
  1. #1
    PrintShopSup is offline Novice
    Windows XP Access 2003
    Join Date
    Nov 2010
    Posts
    11

    Merge 2 queries with null? values

    Our billing database has transaction records that provide data that shows where an order is placed (print shop) and where it is printed (tranferred orders). I use 2 queries to total some data (count of orders and sum of charges) and then another query which "merges" the 2 queries to provide "Ordered vs Printed" data. The company closed 2 print shops this year. Data is still collected from those locations (ordered in) but will not show those shops in the "Printed in" query. Is there a way to modify the "Printed" query to put zeros "0" so that my "merge" query will still show the ordered totals?



    I exported the data, modified it for this forum, and attached the data here for reference. Any insight would be appreciated as I am currently manually adding these records in my report to management.

    Last edited by PrintShopSup; 10-03-2011 at 09:09 PM. Reason: Solved in first post!

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    Change your query jointype to Left:
    LEFT JOIN qryShopTotals_Printed ON (qryShopTotals_Ordered.fldPrintShopOrdered = qryShopTotals_Printed.fldCurrentPrintShopmod) AND (qryShopTotals_Ordered.fldMonth = qryShopTotals_Printed.fldMonth) AND (qryShopTotals_Ordered.fldYear = qryShopTotals_Printed.fldYear)

    Then deal with the null values in the calculation with Nz function.
    expNetDiffCharges: Nz([expTotalChargesPrinted],0)-Nz([expTotalChargesOrdered],0)
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    PrintShopSup is offline Novice
    Windows XP Access 2003
    Join Date
    Nov 2010
    Posts
    11
    Well, I was headed in the right direction. All joins need to be left join. I started using only the print shop as the left join and got the "ambigous" join error. Thanks for helping out. It is a "georgeous" query.


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

Similar Threads

  1. Mail Merge data source queries missing
    By UTS in forum Queries
    Replies: 6
    Last Post: 09-21-2011, 01:48 AM
  2. Replies: 5
    Last Post: 08-29-2011, 09:37 AM
  3. null values
    By ippy in forum Queries
    Replies: 3
    Last Post: 12-20-2010, 10:39 AM
  4. No return on Null values
    By forrestapi in forum Queries
    Replies: 4
    Last Post: 10-18-2010, 08:09 AM
  5. Null Values in query
    By LesleaOH in forum Queries
    Replies: 0
    Last Post: 10-19-2009, 04:45 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