Results 1 to 2 of 2
  1. #1
    1953hogan is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jun 2011
    Posts
    10

    Multiples of same record show up when paging through records

    I have an Inventory database with 2 tables. Here is a simplified version of both tables:

    First Table is Inventory:
    Fields are
    ID
    Description
    PackSize
    PackCost

    Second table is PriceHistory:
    Fields are
    ID
    InventoryID
    Date
    PackCost

    Fields are joined, one to many (one inventory record can have many prices in its history). ID in the inventory table is joined to InventoryID in the PriceHistory table.

    The problem comes when I am browsing records in FORM VIEW of the inventory table:



    As I page through the inventory records, I often see the same record multiple times (once for each entry in the pricehistory table).

    For example, if the item POTATOES in the Inventory table has had it's price updated 3 times (3 entries in the PriceHistory) table, then I see the Potatoes record 3 times as I am browsing.

    I only want to see this record once (with the latest price) when I am browsing the Inventory table in form view. Can somebody help me fix this? Thanks very much.

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    Date is a reserved word in Access. You should either change the name eg mDate, or enclose it in [Date].
    If you only want the latest Price for an item based on the [Date], then you will need to use a constraint to get the Max([Date]) associated with the Item.


    'something like this (untested)
    SELECT * FROM Inventory INNER JOIN PriceHistory on
    Inventory.id = PriceHistory.InventoryID
    WHERE PriceHistory.Date = (Select Max([Date]) FROM PriceHistory B where B.InventoryId = PriceHistory.InventoryID)

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

Similar Threads

  1. Choosing Multiples in a form
    By Jackfam58 in forum Forms
    Replies: 1
    Last Post: 07-31-2012, 08:41 AM
  2. Replies: 2
    Last Post: 01-17-2012, 10:15 AM
  3. DCount for Multiples
    By Huddle in forum Access
    Replies: 2
    Last Post: 12-21-2010, 08:57 AM
  4. Report Paging problem
    By newtoAccess in forum Access
    Replies: 4
    Last Post: 11-15-2010, 10:58 AM
  5. Combo Box - Paging Forward / Back
    By neilrpf in forum Forms
    Replies: 0
    Last Post: 03-01-2006, 05:21 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