View Single Post
  #3  
Old August 29th, 2008, 05:02 AM posted to microsoft.public.access.forms
Pablito
external usenet poster
 
Posts: 6
Default Calculate Total Hours Worked For Week Based On Check Boxes.

Hi Jeff,

Thanks for responding! Actually [SUN], [Mon], [TUE], [Wed], [THU], [FRI]
and [Sat] are check boxes. I have seven check boxes. One for each day of
the week. The way I have the form set up is as a subform on the main form:

Start Time End Time Total Hours For Week Sun Mon Tue Wed Thu
Fri Sat
8:00 AM 2:00 PM 18 X X X
8:00 AM 4:00 PM 24
X X X

What I want the program to do is find the difference between the start time
and the end time: 8:00 AM to 2:00 PM is 6 hours than multiply that by the
number of check boxes that are checked, in this example it's: 3, that would
give us 18 hours for that part of the schedule.

When I used the Whole expression below nothing happened. The field for
"total hours worked for week was blank even after checking a check box. But
when I used this portion aloneateDiff("n",[START_TIME],[END_TIME])/60)) it
gave me the difference in start time and end time.

=Sum(IIf([SUN]=Yes Or [MON]=Yes Or [TUE]=Yes Or [WED]=Yes Or [THU]=Yes Or
[FRI]=Yes Or [SAT]=Yes,DateDiff("n",[START_TIME],[END_TIME])/60))

Please let me know if you need any more info. Again, I really appreciate
your time and effort with this!

Thanks,
Paul


"Jeff Boyce" wrote:

?you have fields named [SUN] and [MON] and ...?

This sounds more like a spreadsheet than a relational database.

You say you've tried the expression below. You don't say what happens when
you try it. Are you getting an error message? Are you getting incorrect
answers?

How do you enter information about a person who starts (and ends) at
different times on different days of the week?

It all starts with the (underlying) data, and I don't have a very clear
picture of that yet...

Regards

Jeff Boyce
Microsoft Office/Access MVP

"Pablito" wrote in message
...
Hi,
I created a Scheduling database. On the scheduling form I have fields for
"the time the person started work", "the time the person ended work",
"total
hours for the week" and check boxes for "sun", "mon", "tues", "wed",
"thur",
"fri" and "sat". I would like the program to automaticly calculate the
total
hours worked for the week based on the amount of check boxes checked. I
have
included some of the code I have tried.

=Sum(IIf([SUN]=Yes Or [MON]=Yes Or [TUE]=Yes Or [WED]=Yes Or [THU]=Yes Or
[FRI]=Yes Or [SAT]=Yes,DateDiff("n",[START_TIME],[END_TIME])/60))

Any help with this wil be greatly appreciated!

Thank you,
Paul