Results 1 to 3 of 3
  1. #1
    jimgros is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2011
    Posts
    8

    struggling with query, plz help

    Hi guys, I'm a beginner and I can't get this query right. plz help.

    I have 1 table that contians my stock. Say fields are:
    Stock_ID
    Size
    Clarity
    Shape
    Color

    I have another table which is a standardized price list. Fields are:


    Size_Min
    Size_Max
    Clarity
    Shape
    Color
    Price

    So I'm trying to get a query going where I have "stock_ID" with it's matching price next to it coming from the standardized price list.

    This is what I did
    SELECT Stock.Stock_ID, Pricelist.price
    FROM Pricelist INNER JOIN Stock ON (Pricelist.Shape = Stock.Shape) AND (Pricelist.Clarity = Stock.Clarity) AND (Pricelist.Color = Stock.Color)
    WHERE (([Stock].[Size]>=[Pricelist].[Min_size] And [Stock].[Size]<=[Pricelist].[Max_size]));

    But I get NADA! Can someone pls help? I really don't understand it sounds so simple...
    The pricelist is really consistent and verified. There are no sizes or colors or clarities missing. All sizes/color/clarity combinations exist in the table and have a unique price.

    Thanks
    Last edited by jimgros; 07-26-2011 at 01:38 AM. Reason: small mistake

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    A join is not going to work because can't join Stock size on PriceList size. Instead of joining the tables, do a lookup of the value. Build a query of the Stock table and create a field with a DLookup expression.

    DLookup("Price", "PriceList", "Shape='" & [Shape] & "' AND Clarity='" & [Clarity] & "' AND Color='" & [Color] & "' AND " & [Size] & " Between [Min_size] And [Max_size]")
    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
    jimgros is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2011
    Posts
    8
    Cool!!! Thx for quick reply. I get now why join might not work.

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

Tags for this Thread

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