Page 2 of 2 FirstFirst 12
Results 16 to 26 of 26
  1. #16
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Okay, need to use DEPTID and LOCID fields and the Department and Location pk values in the DMax. Add those fields to the Requisition query and add textboxes bound to those fields.



    =DMax("[OrderDate]","Orders","DeptID=" & [DeptID] & " AND LocID=" & [LocID])

    Or use the Requisition query as is as the data source for the DMax.
    DMax("OrderDate", "Requisition", "Department='" & [Department] & "' AND Location='" & [Location] & "'")

    Another option is in Report header or footer a textbox with:
    =Max(OrderDate)
    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.

  2. #17
    glen is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2012
    Posts
    171
    Quote Originally Posted by June7 View Post
    Okay, need to use DEPTID and LOCID fields and the Department and Location pk values in the DMax. Add those fields to the Requisition query and add textboxes bound to those fields.

    =DMax("[OrderDate]","Orders","DeptID=" & [DeptID] & " AND LocID=" & [LocID])
    Thanks June.
    this expression is working for me but the problem is when I make new order and put date today then in report the last date issue show today date.Bcoz it becomes max.

  3. #18
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    You want the date just prior to this new order? Try:

    =DMax("[OrderDate]","Orders","DeptID=" & [DeptID] & " AND LocID=" & [LocID] & " AND OrderDate<#" & [OrderDate] & "#")
    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.

  4. #19
    glen is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2012
    Posts
    171
    Thank you June it working fine now.

  5. #20
    glen is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2012
    Posts
    171
    June,
    I want that if there is no last issue date then the box should blank or give some message like " First Order"

  6. #21
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    I don't know why #Type! error, I would have expected #Error.

    Try:
    =Nz(DMax("[OrderDate]","Orders","DeptID=" & [DeptID] & " AND LocID=" & [LocID] & " AND OrderDate<#" & [OrderDate] & "#"),"First Order")
    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.

  7. #22
    glen is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2012
    Posts
    171
    Yes its working.
    But now I realized that this error come when there is no selection in form. with empty form this error coming.
    any solution for this?

  8. #23
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    When there is no selection of what in which form? The main form?

    I can work with Access 2010 database if you want to provide.
    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.

  9. #24
    glen is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2012
    Posts
    171
    yes Main form which name is Orders.
    I attached my db you check and also check logon form there.
    Last edited by glen; 09-14-2012 at 01:45 AM.

  10. #25
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    There is a record in ORDER_DETAIL without an OrderID value. I set it to 3 and then all orders have related detail records and the DLookup works.

    Suggest there is no reason to print an order that does not have any related Order detail records.
    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.

  11. #26
    glen is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2012
    Posts
    171
    Yes June I also set that value to 3 now all expressions working.Thanks

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Multiple Field & date range filter
    By mrkandohi001 in forum Reports
    Replies: 6
    Last Post: 01-18-2012, 03:11 AM
  2. Query/Filter by Date
    By jasonbarnes in forum Reports
    Replies: 6
    Last Post: 01-04-2012, 04:05 PM
  3. Date Range filter in a Duplicate query
    By knickolyed in forum Forms
    Replies: 0
    Last Post: 06-27-2011, 04:56 AM
  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