Results 1 to 6 of 6
  1. #1
    RAJESHKUMAR R is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Oct 2017
    Posts
    48

    Highlight Latest Records with respect to Date/Time

    Dear Experts,



    I have a Access Table contains “ProductID”,”UserInput”,”Updated Date/Time”,”Signal”

    Each “ProductID” contains more number records (rows) with different Date/Time

    Wherever the “Updated Date/Time” value = Max of (Updated Date/Time), The Signal column should get updated as “Latest Update” otherwise update as “Old Update”

    Looking forward your input for the same…

    Thanks & Regards,
    Rajeshkumar R
    Last edited by RAJESHKUMAR R; 12-16-2022 at 05:40 AM. Reason: Formatting

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,558
    Use DMax() and compare against your date field.

    Not sure you should be doing that though as you can calculate it easily with DMax()?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  3. #3
    orange's Avatar
    orange is offline Moderator
    Windows 10 Office 365
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    Can't you just query the table to show the latest record? Or use a form with the query as its recordsource?
    Sounds like SELECT TOP 1.... may be appropriate.

    Code:
    SELECT TOP number|percent column_name(s)
    FROM table_name
    WHERE condition; 

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    Saving aggregate calc is not advised. If it can be calculated for UPDATE it can be calculated when needed. Cannot use an aggregate query as source for an UPDATE action anyway. Would have to use domain aggregate function or VBA looping recordset.
    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
    RAJESHKUMAR R is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Oct 2017
    Posts
    48
    Dear Welshgasman,

    I already tried with below formula in calculated field!

    Code:
    =DMax("Updated Date/Time","table1","ProductID=" & "ProductID")
    When I am trying to save the table, It is showing an error like "Unknown function 'DMAX' in validation expression or default value"

    Please suggest where am I going wrong?

    Thanks & Regards,
    Rajeshkumar R

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    The field name has space and special characters so that requires use of [] delimiters. Don't construct names that way and wouldn't have this issue.

    Also, quote marks around concatenated field are not appropriate.

    Your table is really named "table1"? ProductID is a number type?

    =DMax("[Updated Date/Time]","table1","ProductID=" & ProductID)
    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.

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

Similar Threads

  1. Replies: 3
    Last Post: 03-11-2014, 07:32 PM
  2. Query to Extract records with latest date
    By rkalapura in forum Queries
    Replies: 2
    Last Post: 03-13-2013, 05:48 AM
  3. Highlight rows based on # of child records
    By TheAugustLeo in forum Access
    Replies: 3
    Last Post: 09-20-2012, 10:27 AM
  4. Replies: 5
    Last Post: 04-26-2012, 05:25 PM
  5. Latest Date Records
    By Rick West in forum Queries
    Replies: 1
    Last Post: 09-25-2009, 11:16 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