Query Time Difference AND Monthly Totals (1 Viewer)

gayansam

New member
Local time
Today, 11:00
Joined
Sep 9, 2012
Messages
9
Dear CJ_London

Thanks for the information, however 20:00 and 8:00 result was (-12 h) minus that's why I don't know, I need to calculate two shift day and night, day shift 8:00 to 20:00 and night shift 20:00 to 8:00, some time some people worked 24hours, I made it in Excel because I need to make database.

Thanks,
Gayan:confused:



You have coded

Round(DateDiff('n',[Out_T]-[In_T],1)/60

The actual structure required is
DateDiff(interval, date1, date2 [, firstdayofweek] [, firstweekofyear] )

So you have set date1=[Out_T]-[In_T]
and date2=1
 

CJ_London

Super Moderator
Staff member
Local time
Today, 03:00
Joined
Feb 19, 2013
Messages
16,663
if you cross the midnight line then your in/out times need to include the date as well
 

RainLover

VIP From a land downunder
Local time
Today, 12:00
Joined
Jan 5, 2009
Messages
5,041
gayansam

I did ask this question before but never got an answer.

In the Table what Data Type are you using. And please could you post some samples of what is stored in the table.

A screen shot of table in Datasheet would be good to see.

A second screen shot with all formatting removed would also help.
 

gayansam

New member
Local time
Today, 11:00
Joined
Sep 9, 2012
Messages
9
This may database,


thanks
 

Attachments

  • Gayan.accdb
    688 KB · Views: 68

RainLover

VIP From a land downunder
Local time
Today, 12:00
Joined
Jan 5, 2009
Messages
5,041
Can you convert the Database to Version 2003.

I don't have 2007 or later.
 

gayansam

New member
Local time
Today, 11:00
Joined
Sep 9, 2012
Messages
9
Dear RainLover,

It's here
 

Attachments

  • Gayan.mdb
    244 KB · Views: 70

RainLover

VIP From a land downunder
Local time
Today, 12:00
Joined
Jan 5, 2009
Messages
5,041
Most Important that you do not use Date as the name of a field. Date is a reserved word. Same as things like Now, Name and If.

Do a Google for a full list which is quite large.

More to come shortly.
 

RainLover

VIP From a land downunder
Local time
Today, 12:00
Joined
Jan 5, 2009
Messages
5,041
I have just taken the first calculated field and made a small adjustment.

Code:
     Total_h: DateDiff('n',[In_T],[Out_T])/60

Do a Copy Paste into your query. It should be correct.

You may want more so get this part sorted then post back.

Access Help has some good information on this sort of thing.
 
Last edited:

gayansam

New member
Local time
Today, 11:00
Joined
Sep 9, 2012
Messages
9
Thanks Dear RainLover it's correct



I have just taken the first calculated field and made a small adjustment.

Code:
     Total_h: DateDiff('n',[In_T],[Out_T])/60
Do a Copy Paste into your query. It should be correct.

You may want more so get this part sorted then post back.

Access Help has some good information on this sort of thing.
 

RainLover

VIP From a land downunder
Local time
Today, 12:00
Joined
Jan 5, 2009
Messages
5,041
It is nice to be able to help with the correct answer.

Good Luck with the balance of the project.
 

Users who are viewing this thread

Top Bottom