Max Date & Time

dungeon

New member
Local time
Today, 22:28
Joined
Nov 19, 2008
Messages
4
Hi,

I have a table (tblContacts) with separate fields for Date, Time, Group and Subject (there are others but these are the only ones I want). I'm trying to write a query that will generate a single record with those 4 fields for the latest contact for a specified Group. ie. I would like it to return Date, Time, Group, Subject for the most recent Date and Time.

The Group bit I'm ok with - it is linked to a combo button on a form. From there I have assumed that I will need to get the max date and from that the max time to produce the single record.

I can get the most recent Date using Max([Date]) but I can't seem to get the max Time from there.

Any help would be appreciated.

Cheers
 
First thing up =

You should have the date and time as a SINGLE field. It would let you do the max much easier.

Second -

If your field is named Date and Time then change the names as those are Access Reserved Words and will cause you no end of grief if you keep them as is. I would also change the field named Group as well, as I believe that is also a reserved key word.

Once you do that then you should be in a better situation to get the latest record.
 
My question is similiar to this question...

I have a set of data with record column, dates coloumn and active/inactive column. However the dates column has past, current and future active dates. How do I set the paramenter to give me just the last inactive date the most current active date of the record #?

Thanks
 
As well as looking for Max date you are going to need to specify criteria

a simple example

SELECT Max(Table1.dteDate) AS MaxOfdteDate
FROM Table1
WHERE (((Table1.dteDate)<=Date())):
 

Users who are viewing this thread

Back
Top Bottom