Results 1 to 8 of 8
  1. #1
    Auditboy is offline Novice
    Windows 10 Access 2016
    Join Date
    Aug 2018
    Posts
    4

    Cool How to use MAX or DMAX to get the results by day not by column

    Good Afternoon, I am try to get Max or Dmax for each date not the whole column. If I use the MAX for Message Date/Time it will take the MAX date for the whole column. I want to get the Max date for each day. Any ideas or thought? using Access 2010. Thank you


    Message Text Message Date/Time
    iSTAR Input 'Kerr Hall Door 001 Local Alarm Bypass [KERR HALL]' is active. 8/27/2018 7:50:02 AM
    iSTAR Input 'Kerr Hall Door 200C Local Alarm Bypass [KERR HALL]' is active. 8/27/2018 7:50:02 AM
    iSTAR Input 'Kerr Hall Door 200D Local Alarm Bypass [KERR HALL]' is active. 8/27/2018 7:50:02 AM
    iSTAR Input 'Kerr Hall Door 200F Local Alarm Bypass [KERR HALL]' is active. 8/27/2018 7:50:02 AM
    iSTAR Input 'Keer Hall Door 100 Local Alarm Bypass [KERR HALL]' is active. 8/27/2018 7:50:03 AM
    iSTAR Input 'Keer Hall Door 200 Local Alarm Bypass [KERR HALL]' is active. 8/27/2018 7:50:03 AM
    iSTAR Input 'Keer Hall Door 100 Local Alarm Bypass [KERR HALL]' is active. 8/28/2018 7:50:02 AM
    iSTAR Input 'Keer Hall Door 200 Local Alarm Bypass [KERR HALL]' is active. 8/28/2018 7:50:02 AM
    iSTAR Input 'Kerr Hall Door 001 Local Alarm Bypass [KERR HALL]' is active. 8/28/2018 7:50:02 AM
    iSTAR Input 'Kerr Hall Door 200C Local Alarm Bypass [KERR HALL]' is active. 8/28/2018 7:50:02 AM
    iSTAR Input 'Kerr Hall Door 200D Local Alarm Bypass [KERR HALL]' is active. 8/28/2018 7:50:02 AM


    iSTAR Input 'Kerr Hall Door 200F Local Alarm Bypass [KERR HALL]' is active. 8/28/2018 7:50:02 AM

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    Something like

    SELECT DateValue(DateTimeField), Max(DateTimeField) AS MaxValue
    FROM TableName
    GROUP BY DateValue(DateTimeField)
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Auditboy is offline Novice
    Windows 10 Access 2016
    Join Date
    Aug 2018
    Posts
    4
    Not very familiar with SQL. How would you write the expression in access?

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    That is Access SQL. You can start a new query, switch to SQL view and copy that in, changing the names as appropriate.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    Auditboy is offline Novice
    Windows 10 Access 2016
    Join Date
    Aug 2018
    Posts
    4
    I will try that. Thank you

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    No problem, post back if you get stuck. Welcome to the site by the way!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    Auditboy is offline Novice
    Windows 10 Access 2016
    Join Date
    Aug 2018
    Posts
    4
    I keep getting this error.

    This is what I currently have

    SELECT [1 LA_Active_TBtest].[Message Text], [1 LA_Active_TBtest].[Message Date/Time]
    FROM [1 LA_Active_TBtest]
    GROUP BY [1 LA_Active_TBtest].[Message Text], [1 LA_Active_TBtest].[Message Date/Time], [1 LA_Active_TBtest].Inactive
    ORDER BY [1 LA_Active_TBtest].[Message Date/Time];



    The Message Date/Time has the time in it. Not sure if this makes a difference or not. Example. 8/27/18 7:50:45 AM

    Thank you for your time.

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    Well, you didn't use the DateValue() function, nor the Max(), and you added a new field. If you need the message text too, try this two-query method:

    http://www.baldyweb.com/LastValue.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Multple Column Results
    By dml5055 in forum Access
    Replies: 1
    Last Post: 06-14-2016, 09:12 PM
  2. DMAx Question for Report - DMax <= Dtae
    By crimedog in forum Access
    Replies: 8
    Last Post: 12-29-2014, 09:31 PM
  3. Replies: 6
    Last Post: 12-15-2014, 07:53 PM
  4. Replies: 6
    Last Post: 07-24-2012, 03:02 PM
  5. Replies: 1
    Last Post: 10-24-2011, 04:11 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