Results 1 to 3 of 3
  1. #1
    Rizvi is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Oct 2017
    Posts
    12

    how to display last record added in a table in form

    Hi
    if any one can help me out. i have a table which is working as an audit trail having three fields id,staff and latest update date. this table will store the changes done in another table done by the staff and the latest date of changes done. i need to check and to display in a form the last record added in this table. if any one can provide me with vb code


    thanks in advance
    regards

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,921
    Records in table do not have intrinsic order. Need criteria to find the 'last' record. Could be a sequence identifier (autonumber field can usually serve) or a date.

    SELECT * FROM table WHERE ID IN (SELECT Max(ID) AS MaxID FROM table);

    or

    SELECT * FROM table WHERE ID = DMax("ID", "Table");
    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
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,424
    autonumber may not be reliable for your purposes - perhaps you need a timestamp field - see this link for reasons why

    http://www.utteraccess.com/wiki/Auto..._What_They_Are

    in particular, look at point 4 for the illustration. This may not be relevant for your situation, in which case autonumber should be OK

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

Similar Threads

  1. Replies: 8
    Last Post: 10-25-2017, 01:59 PM
  2. Replies: 4
    Last Post: 07-21-2015, 02:50 PM
  3. Replies: 2
    Last Post: 11-07-2014, 02:53 PM
  4. Replies: 7
    Last Post: 04-15-2014, 01:15 PM
  5. Blank Record Being Added to Table
    By Andrew in forum Programming
    Replies: 8
    Last Post: 12-22-2011, 04:41 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