Help to combine code in query.

giaruso

Registered User.
Local time
Today, 08:49
Joined
Jul 14, 2005
Messages
12
I am using the two lines of code below Each in separate columns of a query (or two text Boxes on a form) to calculate the elapsed time between two dates formatted as General Dates. The first line of code (in column A, "txtTime1") calculates to the total minutes between the two dates, the second line of code (in column B, "txtTime2") takes the minutes and converts them to total elapsed hours and minutes. They work great, however, I would like to combine this code and place it in only one query column or form Text Box. My VBA is not up to it, can someone out there show me how to combine the code below to produce the hours and minutes in one line of code? Thanks

=DateDiff("n",[StartDate],[CompleteDate])

=[txtTime1]\60 & Format([txtTime1] Mod 60,"\:00") :confused:
 
Why not...

=(DateDiff("n",[StartDate],[CompleteDate]))\60 & Format((DateDiff("n",[StartDate],[CompleteDate])) Mod 60,"\:00")

All that you are doing is replacing the field name with the calculation in the main query.
 
Mresann, too kind, thanks much. Giaruso
 

Users who are viewing this thread

Back
Top Bottom