PDA

View Full Version : Solved: Date/Time Stamp quetion in a form



Mavver
04-19-2007, 03:57 AM
I have a form which I want to order on two elements of one variable, The date and the time of a date/time stamp field.

Basically I want the latest dates to be the first records, but the earliest times to take precedence over later times on those dates.

It is probably easier if I give an example.

The Date field I am using has the following data in it

4/18/2007 13:22:52
4/16/2007 22:49:49
4/18/2007 13:06:05
4/13/2007 09:18:26
4/17/2007 11:19:21
4/17/2007 10:44:55
4/18/2007 11:34:23
4/17/2007 10:15:54
4/16/2007 20:00:10
4/13/2007 13:08:50

If I sort the data in descending order to get the latest date first I will get the following

4/18/2007 13:22:52
4/18/2007 13:06:05
4/18/2007 11:34:23
4/17/2007 11:19:21
4/17/2007 10:44:55
4/17/2007 10:15:54
4/16/2007 22:49:49
4/16/2007 20:00:10
4/13/2007 13:08:50
4/13/2007 09:18:26

But if you notice the time stamp is then is descending order. What I need is the following, the date stamp in descending order and then the time stamp in ascending order, like below

4/18/2007 11:34:23
4/18/2007 13:06:05
4/18/2007 13:22:52
4/17/2007 10:15:54
4/17/2007 10:44:55
4/17/2007 11:19:21
4/16/2007 20:00:10
4/16/2007 22:49:49
4/13/2007 09:18:26
4/13/2007 13:08:50

The date time stamp comes in from an import, so it is easy enough to duplicate it into another column. So the idea that I have was to do this, set the first occurance of the date/time to be a Medium Date and the second to be a Long Time and then order the form on the two variables

Order by........InboxMerged.Received DESC, InboxMerged.ReceivedTime

But this did not work.

Hopefully this has been explained well enough to show the problem and hopefully someone out there can give me some adivce on how to sort this

Ta for any help

Mav

OBP
04-19-2007, 04:26 AM
Would it be worth "splitting" the Imported Time Stamp in to Date and Time fields to go in the Access database Table during the "import process"?
Alternatively this can be done at the Query stage for the form.
You can "split" the Time Stamp by using "Format", have one column formatted to Date Only and a second column formatted to Time Only. Sort on those fcolumns instead of the Time Stamp Column.

Mavver
04-19-2007, 08:19 AM
Yep, simplicity itself

I changed it from a straight import to a TimeValue() function, thus clearing all of the dates out of the second column.

Ta for the push in the right direction

Mav

OBP
04-19-2007, 08:42 AM
:thumb