Results 1 to 3 of 3
  1. #1
    hansamuq is offline Novice
    Windows 10 Access 2016
    Join Date
    Apr 2016
    Posts
    2

    How to create product query based on inactive dates

    Hi all MS Access Gurus,



    I wanted to create a query to query which products have never been purchased in the year of 2014-2015.

    I have a record of Sales order as below.
    The sales order will has the below fields
    ID Customer Date ProductCode Quantity
    1 CustomerA 2/3/2012 1001 10
    2 CustomerA 2/3/2015 2001 10
    3 CustomerB 2/4/2011 2001 10
    4 CustomerC 5/3/2009 3001 10

    And i have a productcode table as below
    The productcode table has the below fields
    ProductCode Cost$ Selling$
    1001 $1 $3
    2001 $2 $5
    3001 $6 $10
    4001 $15 $50
    5001 $40 $55

    The problem i have is that when i do a query based on sales order and criteria by date based on "Not Between 1/1/2014 And 31/12/2015", it will show me the follow;
    ProductCode
    1001
    3001

    But the problem is that under productcode table, 4001 and 5001 has no purchases at all and these 2 product code should also be in this query. how can i make that happen?

  2. #2
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,428
    include your productcode table with a left join to the sales table and modify your criteria to

    date Not Between 1/1/2014 And 31/12/2015 or date is null

    I presume date is not the real name of your field

  3. #3
    hansamuq is offline Novice
    Windows 10 Access 2016
    Join Date
    Apr 2016
    Posts
    2
    Got it working
    First find which products have been purchased in the year of 2014-2015.
    Then use that in an unmatched query against the productcode table.

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

Similar Threads

  1. Replies: 1
    Last Post: 02-03-2016, 05:24 PM
  2. Replies: 6
    Last Post: 02-28-2015, 11:57 AM
  3. Replies: 3
    Last Post: 01-18-2015, 06:05 PM
  4. Replies: 11
    Last Post: 11-06-2014, 06:01 PM
  5. Replies: 7
    Last Post: 07-11-2013, 10:45 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