time difference

  • Thread starter Thread starter Clan McCreery
  • Start date Start date
C

Clan McCreery

Hello, I'm trying to get the time difference in
hours:minutes between to "short date" fields. I was told
I could use the DateDiff function in my query:

(DateDiff("hh:nn", TimeIn, TimeOut))

All I get is an error. Any ideas please?

Thanks!

Clan McCreery
 
DateDiff can only one unit: it'll give you the difference in Minutes, or it
will give you the difference in Hours, but it can't do both.

You could use it to give you the difference in Minutes, and then convert
minutes to hours and minutes, using something like the following untested
air-code:

Function FormatTimeInMinutes(MinutesIn As Long) As String

FormatTimeInMinutes = MinutesIn\60 & ":" & _
Format$(MinutesIn Mod 60, "00")

End Function

Another possibility is to use the Diff2Date function Graham Seach and I
wrote. Check http://members.rogers.com/douglas.j.steele/Diff2Dates.html
 
Thanks - I tried the code from the page you suggested
using the "hns" and I still got an error. Whenever I try
to get "hns" whether thru your code or the standard
datediff code, my db shuts down and sends an error report
to MS. :-( My client must have hour,minute.....I'll try
your air-code next. Thanks again...Denise
 
There could be something wrong with your database: I've never heard of a
problem with that code.

Try creating a new database, and importing all of the objects from your
existing database into it.
 
Back
Top