Results 1 to 3 of 3
  1. #1
    JimO is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    Dec 2015
    Posts
    126

    DLookup for last value entered?

    I am very new to Access so this will be on a very very basic level.



    I am trying to return the last value entered in a column based on the last date. If I were to write this for Excel I would use Index and the Max value from a date column. I have tried using DLookup and the date but my problem is the date is not always today's date.

    Code:
    =DLookUp("INR","WarfarinT","Date=Date()")
    returns a 'Blank' value and,

    Code:
    =DLookUp("INR","WarfarinT","Date=>Date()")
    returns an '#Error'.

    I'm looking for the last value in column 'INR' from the 'WarfarinT' to be returned to a form. The first example works if the last date entered is equal to today, but being very new to Access I am not sure if I am on the correct tract or not.

    Thanks
    Jim O
    Last edited by JimO; 01-11-2016 at 07:13 PM. Reason: Solved

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    This does get tricky. Options are a TOP N query or nested subquery or more complex domain aggregate. Will there be only one record for each date?

    =DLookup("INR", "WarfarinT", "[Date]=#" & DMax("[Date]", "WarfarinT") & "#")


    Date is a reserved word - should not use reserved words as names. Note the [] because of this.
    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
    JimO is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    Dec 2015
    Posts
    126
    June,

    Thanks for the response. That seems to do the trick.

    Jim O

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

Similar Threads

  1. Retrieve entered value
    By zipaway in forum Programming
    Replies: 3
    Last Post: 06-10-2014, 08:53 AM
  2. Replies: 2
    Last Post: 07-30-2012, 03:26 PM
  3. Replies: 4
    Last Post: 05-17-2012, 02:47 PM
  4. Replies: 4
    Last Post: 08-25-2011, 07:57 AM
  5. Record appear if been entered before
    By miziri in forum Programming
    Replies: 2
    Last Post: 08-17-2011, 05:36 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