Start and End Dates

Qualinwraith

Registered User.
Local time
Today, 22:59
Joined
Dec 12, 2005
Messages
26
I have a query that is generating two colums, one the states the Start Date and the other that States the End Date. I need to display another column that displays the time difference between the two. Any ideas how?
 
Try using the DateDiff function. Not sure what you mean by "time" though. The smallest unit DateDiff has is days.
 
it did help but unfortunately since I'm generating the colums with the dates out of a query, when I run the whole thing it is asking me to insert the First Date and Last Date manually and not accepting the existing columns
 
reclusivemonkey said:
Try using the DateDiff function. Not sure what you mean by "time" though. The smallest unit DateDiff has is days.

reclusivemonkey, the smallest unit DateDiff can handle is seconds.
 
SJ McAbney said:
reclusivemonkey, the smallest unit DateDiff can handle is seconds.

Oh right. My text book doesn't have anything about seconds in it, but then again it is for Access 2000.
 
reclusivemonkey said:
Oh right. My text book doesn't have anything about seconds in it, but then again it is for Access 2000.

No need to read the textbook. Access does come with a help file at the press of a button. ;)
 
Sounds like you have the SQL wrong, can you post it please

Peter
 
Qualinwraith said:
it did help but unfortunately since I'm generating the colums with the dates out of a query, when I run the whole thing it is asking me to insert the First Date and Last Date manually and not accepting the existing columns

You will need to base a second query off this query as you can't use calculations in a query whilst it calculates. Of course, I'd like to see your SQL too.
 
This is my current SQL statement. Note that this one is asking me to enter the values manually instead of taking those found in the columns.

SELECT tblMoscow_Transactions.FK_PledgeID, Max(tblMoscow_Transactions.intStatus) AS [Last Status], Min(tblMoscow_Transactions.dtmStatusDate) AS [First Date], Max(tblMoscow_Transactions.dtmStatusDate) AS [Last Date], DateDiff("y",[First Date],[Last Date]) AS DaysElapsed
FROM tblMoscow_Transactions
GROUP BY tblMoscow_Transactions.FK_PledgeID, DateDiff("y",[First Date],[Last Date]);
 
Have you tried using the Min/Max in the Datediff?

DateDiff("y",Min(tblMoscow_Transactions.dtmStatusDate) ,(tblMoscow_Transactions.dtmStatusDate) );

Peter
 

Users who are viewing this thread

Back
Top Bottom