Results 1 to 2 of 2
  1. #1
    dhawan_aj is offline Novice
    Windows 10 Access 2016
    Join Date
    Feb 2019
    Posts
    1

    Yard in query

    The goal for this query is to achieve the yard report at any time I run the query. To clarify when I run this query I want to know: what the trailers status loaded/empty/other currently in the yard. I don't need any information on the trailers that are out of the yard. The status must change if the trailer leaves the yard: in other words it will not appear on the query anymore.




    These are four columns IN/OUT, LOADED/EMPTY, TRAILER#, DATE & TIME


    IN/OUT LOADED/EMPTY TRAILER DATE & TIME
    IN LOADED 456667 2/10/2019 1:12:00 PM
    IN EMPTY 53004 2/11/2019 2:00:00 PM
    IN LOADED 53005 2/10/2019 2:35:00 PM
    OUT LOADED 53005 2/10/2019 1:00:00 PM
    IN EMPTY 53006 2/11/2019 10:35:00 AM
    IN LOADED 53665 2/9/2019 4:00:00 PM
    OUT LOADED 54334 2/10/2019 3:10:00 PM


    Please advise how I can get those results in the query. "HELP ME"

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    seem you only need the MAX datestamp of the Trailer on condition '
    IN LOADED'
    do this in 2 queries:

    Q1: get the last record
    select
    [in/out]
    , Max(Date) from table


    Q2: get only the IN trailers using Q1
    select trailer , MaxDate from Q1
    where [in/out]='IN LOADED'


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

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