|
From: blueman on 12 Jun 2008 10:19 Can I use something like DateDiff [TimeIn], [TimeOut]) to calculate elapsed time? I'm not interested in the date. I have the fields set to medioum time, i.e 11:30 AM I don't know vba and really don't have time to learn if it's avoidable. Im doing this for my business and am not a programmer. Thanks Mike
From: John Spencer on 12 Jun 2008 10:27 DateDiff("n",[TimeIn],[TimeOut]) will return the number of minutes between to times. If you want seconds then use "s" instead of "n". If your times include a date compoment then you will need to strip off the date DateDiff("n",TimeValue([TimeIN]),TimeValue([TimeOut])) '==================================================== John Spencer Access MVP 2002-2005, 2007-2008 Center for Health Program Development and Management University of Maryland Baltimore County '==================================================== blueman wrote: > Can I use something like DateDiff [TimeIn], [TimeOut]) to > calculate elapsed time? > > I'm not interested in the date. I have the fields set to medioum time, > i.e 11:30 AM > > I don't know vba and really don't have time to learn if it's > avoidable. Im doing this for my business and am not a programmer. > > Thanks > > > Mike
From: Klatuu on 12 Jun 2008 11:15 John has given you the correct answer, but one caveat. If, by chance, [TimeIn] happened to be a later time on the previous day, you will get a negative number returned. If it was an earlier time on a previous day, the returned value will be misleading. For example [TimeIn] = 6/11/2008 10:15:00 PM [TimeOut] = 6/12/2008 10:01:01 AM =DateDiff("n", TimeValue([TimeIn], [TimeOUt]) returns -734 =DateDiff("n", [TimeIn], [TimeOut]) returns 706 706 is the correct answer regardless of the date portion of the value Leaving out the TimeValue will be accurate. =DateDiff("n", [TimeIn], [TimeOut]) -- Dave Hargis, Microsoft Access MVP "blueman" wrote: > Can I use something like DateDiff [TimeIn], [TimeOut]) to > calculate elapsed time? > > I'm not interested in the date. I have the fields set to medioum time, > i.e 11:30 AM > > I don't know vba and really don't have time to learn if it's > avoidable. Im doing this for my business and am not a programmer. > > Thanks > > > Mike >
|
Pages: 1 Prev: desktop shortcut's icon Next: How to launch a form from a table? |