Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2018
    Posts
    1

    Access Query Returning 95,000 results

    Hi everyone,


    I am having an issue with my Access Database returning duplicates.


    Context: At my workplace we prepare microbiological 'Media' (Agars etc.), which is held in tblPrep_Records. There is a table containing information about the media, including the price per litre.


    I have created a few queries which check to see if the Media on tblPrep_Records matches either the Media Abbrev or Media Long on tblProductPriceList, these work fine.




    However, bespoke media is sometimes made that isn't on tblPriceProductList, so I tried to make a query (qryCalculate2) that returns records from tblPrep_Record if they are not listed on tblPriceProductList but this instead returns ~95,000 records.



    ^Link to database





    Any help would be appreciated
    Attached Files Attached Files
    Last edited by RuralGuy; 08-03-2018 at 09:14 AM. Reason: Uploaded a zip copy of the db

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    Set the query property to UNIQUE VALUES =true.

    depending on the fields in the qry, you may get dupes regardless.

  3. #3
    davegri's Avatar
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,741
    Try this:
    Create this query and name it qInterimUnmatched
    Code:
    SELECT DISTINCT tblPriceProductList.[Media ID], tblPrep_Record.Media, tblPrep_Record.water
    FROM tblPrep_Record INNER JOIN tblPriceProductList ON tblPrep_Record.Media = tblPriceProductList.[Media Long]
    WHERE (((tblPriceProductList.[Media Long]) Is Null)) OR (((tblPriceProductList.[Media Abbrev]) Is Null));
    then change existing qryCalculate2
    Code:
    SELECT  tblPriceProductList.[Media Long], tblPriceProductList.[Media Abbrev], (Val([qInterimUnmatched].[Water]))*[tblPriceProductList]![Cost Per Litre] AS Cost, AlphaOnly([Water]) AS Alphas INTO qryCalculateTEMP2
    FROM tblPriceProductList INNER JOIN qInterimUnmatched ON tblPriceProductList.[Media ID] = qInterimUnmatched.[Media ID];
    It will create 11 records in the new table with the data you posted.
    Last edited by davegri; 08-03-2018 at 11:28 AM. Reason: more

  4. #4
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    Called out for cross posting here
    https://www.mrexcel.com/forum/micros...0-results.html
    a few days ago, but no acknowledgement there by OP on that
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

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

Similar Threads

  1. Like query not returning all results
    By robbeh in forum Queries
    Replies: 3
    Last Post: 10-10-2014, 02:32 PM
  2. Query not returning all expected results
    By amenitytrust in forum Queries
    Replies: 6
    Last Post: 11-05-2012, 07:13 AM
  3. Query returning more results than wanted
    By thedanch in forum Queries
    Replies: 4
    Last Post: 06-19-2012, 08:24 AM
  4. Replies: 5
    Last Post: 10-27-2011, 09:08 PM
  5. Query not returning all of the results
    By velvettiger in forum Queries
    Replies: 4
    Last Post: 03-11-2010, 06:56 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