Results 1 to 5 of 5
  1. #1
    glen is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2012
    Posts
    171

    How to filter last date using Dmax

    Hello,
    I have a form "Orders" with sub form "Deliveries"
    In one order there are too many deliveries.
    every delivery have a delivery date.
    I want to filter the last date in delivery dates.
    I am using this expression but not working.

    =DMax("deliverydate","deliveries","orderid=" & [Forms]![orders]![orderid] & "and deliverydate<#" & [deliverydate] & "#")

    Plz tell me what will be the correct expression.


    Thanks

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,624
    Where are you using that expression?

    Why isn't it working - error message, wrong results, nothing happens?
    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
    glen is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2012
    Posts
    171
    I am using this expression in report in unbound text box. No error but it gives wrong result. I want that when I m in serial 6 in form and I press prieiew it should show me date of serial 5 when I m in serial 5 it should show me date of serial 4 etc. Hoping you will be understand what I want. Thanks

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,624
    =DMax("deliverydate", "deliveries", "orderid=" & [Forms]![orders]![orderid] & " AND SerialNO<" & [SerialNo])

    OR

    SERIALNO will always be sequential - no gaps?

    =DLookup("deliverydate", "deliveries", "orderid=" & [Forms]![orders]![orderid] & " And SerialNO = " & [SerialNo]-1)
    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.

  5. #5
    glen is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2012
    Posts
    171
    Yes Serialno will always be sequential.
    And I used the first one expression it working nice.
    Thank you very much.

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

Similar Threads

  1. Filter by date and then count
    By mosheva in forum Queries
    Replies: 4
    Last Post: 09-13-2012, 10:27 AM
  2. Replies: 6
    Last Post: 07-24-2012, 03:02 PM
  3. Query/Filter by Date
    By jasonbarnes in forum Reports
    Replies: 6
    Last Post: 01-04-2012, 04:05 PM
  4. Filter By Date In Different Fields
    By Douglasrac in forum Queries
    Replies: 13
    Last Post: 03-21-2011, 05:24 PM
  5. Filter by date
    By adsm in forum Forms
    Replies: 3
    Last Post: 08-20-2010, 06:50 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