Results 1 to 5 of 5
  1. #1
    MFS is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2009
    Location
    Ohio
    Posts
    235

    Show last data entry per day

    I have data going into a table every minute, (I'm monitoring critical Boiler data at my facility. This data is being generated via a PLC.)


    I have one field that is a running sum of 'Gas Usage'

    I'm needing a query that will only show the last 'Gas Usage' data entry for any given day.
    What makes this difficult is that today the last entry may be at 23:59:32 and tomorrow it could be 23:59:54. This is due to the triggering and time within the PLC Logic and DB.

    Any help would be greatly appreciated,

  2. #2
    Gicu's Avatar
    Gicu is offline VIP
    Windows 8 Access 2013
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,235
    Hi,

    Create a separate totals query where you use group by your ID and Max([YourDate]), then in another query based on your full table you join both fields (ID to ID and [YourDate] to [MaxOfYourDate]).

    Cheers,
    Vlad

  3. #3
    MFS is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2009
    Location
    Ohio
    Posts
    235
    Thank You Gicu,
    That does exactly what I am looking for.

  4. #4
    Gicu's Avatar
    Gicu is offline VIP
    Windows 8 Access 2013
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,235
    Glad to help!

  5. #5
    Join Date
    Apr 2017
    Posts
    1,775
    I have one field that is a running sum of 'Gas Usage'
    I hope you have a datetime field too! Otherwise it will be Mission Impossible!

    The saved query will be
    Code:
    qDateMaxTime = SELECT INT(YourDateField) AS DateInt, MAX(YourDateField) As MaxDateTime FROM YourTable GROUP BY INT(YourDateField)
    The query to get latest GasUsage for every date
    Code:
    SELECT yt.YourDateField, yt.GasUsage FROM YourTable yt INNER JOIN qDateMaxTime mt ON mt.MaxDateTime = yt.YourDateField

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

Similar Threads

  1. Show Running Balance on Data Entry Form
    By hawzmolly in forum Forms
    Replies: 5
    Last Post: 06-30-2019, 03:27 AM
  2. Replies: 2
    Last Post: 12-11-2015, 02:55 PM
  3. Replies: 7
    Last Post: 03-05-2015, 07:34 AM
  4. Unbound text boxes show #ERROR on data entry line
    By GraeagleBill in forum Forms
    Replies: 4
    Last Post: 01-07-2015, 12:44 AM
  5. Can't get new field to show in my data entry form
    By Suzie in forum Database Design
    Replies: 19
    Last Post: 12-21-2009, 03:48 PM

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