Time Calculations

  • Thread starter Thread starter Bob G
  • Start date Start date
B

Bob G

Not sure If I need to post this here or in Word NG. (Will
probably do both) Trying to calculate time difference
(End time - start time) in a field merged from Access 2000
to Word 2000 document. Simple {= endtime-starttime}
doesn't work. Any thoughts?
 
Have Word connect to a query in Access, not directly to the table. In the
query you can make a calculated field. Use the DateDiff function to get your
time difference.
 
Did that. Access expresses the difference as hh:mm, but
when it goes into Word, I get a fraction of 24 hrs. Tried
\@ "HH:Mm" switch, to no avail. Any thoughts?
 
Access deals with dates and times as numbers. The Format function should
return text. Try wrapping the calculation with Format even though it already
shows, by default, the way you want in Access. This hopefully will change it
to text so that Word will handle it properly. If that doesn't work, perhaps
wrapping it in CStr will.

I just tried the following query as a data source for Word and received the
time as 01:15.

SELECT Format(#16:0:0#-#14:45:0#,"Short Time") AS TimeTest, Table1.Field1
FROM Table1;

I also tried wrapping the Format with CStr and that appeared to work also.
CStr(Format(#16:0:0#-#14:45:0#,"Short Time"))
 
Did you try putting a Format() statement around your elapsed time result?
Something like =format(ELapsedTime, "hh:mm:")

HTH
 
Back
Top