Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2014
    Posts
    2

    How to auto-populate a field based on a query on another table

    Hi,


    I am using access 2007.


    I am using the following tables:


    1) PriceMaster with fields
    -PriceDate
    -ProductCode
    -UOM
    -UnitPrice.
    The PK is a combination of PriceDate, ProductCode & UOM.


    2) Sales with fields
    -InvoiceNo (PK)
    -SaleDate
    -ProductCode
    -UOM
    -UnitPrice
    -Quantity -Amount






    I have a form based on the Sales table. When the user enters the SaleDate, ProductCode and the UOM, I want to query the PriceMaster table and find the record wherein


    the SaleDate <= PriceDate and Sales.ProductCode = PriceMaster.ProductCode and Sales.UOM = PriceMaster.UOM.


    I am struggling to get this done.


    Would appreciate if someone can throw some light on how to achieve this.


    Thanks in advance,
    Lissy

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Along the lines of:

    SELECT TOP 1...
    FROM...
    WHERE...
    ORDER BY PriceDate DESC
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Join Date
    Feb 2014
    Posts
    2
    Hi, Could you please explain a little bit in detail?


    Quote Originally Posted by pbaldy View Post
    Along the lines of:

    SELECT TOP 1...
    FROM...
    WHERE...
    ORDER BY PriceDate DESC

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

Similar Threads

  1. Replies: 2
    Last Post: 12-04-2013, 05:38 PM
  2. Replies: 2
    Last Post: 11-27-2013, 05:24 PM
  3. Replies: 7
    Last Post: 11-28-2012, 01:41 PM
  4. Replies: 3
    Last Post: 10-03-2011, 02:33 PM
  5. Replies: 3
    Last Post: 10-05-2009, 07:22 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