Form Code

G

Guest

I have a form that looks like this:

Sunday Monday Tuesday Wednesday Thursday Friday
Saturday
Timein 12:00AM 12:00AM 12:00AM 12:00AM 12:00AM 12:00AM 12:00AM
Timeout 12:00AM 12:00AM 12:00AM 12:00AM 12:00AM 12:00AM 12:00AM

Under each time box there are controls that are filled with the expression
that looks like this: (((([End Time]-[Start Time])*24)*60)/60). This returns
the value of total hours worked for the day. This all works just fine. The
problem is I have 2 boxes that total each of the controls under each day.
This boxes function looks like this: iif((((([Total Hours])>40,40,([Total
Hours]). I know it is not formatted correctly in here. I have another box
that subtracts Total hours minus overtime. Now that you know a little about
the form....MY PROBLEM!!!

The box that totals each of the Hours Worked per day. If I only have 1 day
added (Monday 8:00 AM - 4:00 PM), it does not return 8 hours in the Total
Hours box, it returns something like (40) hours meaning it is negative. It
will fix itself and be correct if I add just one hour on any other day.
 
M

Marshall Barton

Raymond said:
I have a form that looks like this:

Sunday Monday Tuesday Wednesday Thursday Friday
Saturday
Timein 12:00AM 12:00AM 12:00AM 12:00AM 12:00AM 12:00AM 12:00AM
Timeout 12:00AM 12:00AM 12:00AM 12:00AM 12:00AM 12:00AM 12:00AM

Under each time box there are controls that are filled with the expression
that looks like this: (((([End Time]-[Start Time])*24)*60)/60). This returns
the value of total hours worked for the day. This all works just fine. The
problem is I have 2 boxes that total each of the controls under each day.
This boxes function looks like this: iif((((([Total Hours])>40,40,([Total
Hours]). I know it is not formatted correctly in here. I have another box
that subtracts Total hours minus overtime. Now that you know a little about
the form....MY PROBLEM!!!

The box that totals each of the Hours Worked per day. If I only have 1 day
added (Monday 8:00 AM - 4:00 PM), it does not return 8 hours in the Total
Hours box, it returns something like (40) hours meaning it is negative. It
will fix itself and be correct if I add just one hour on any other day.


It seems like there has to be multiple End Time and Start
Time values, so I don't understand how that works at all.

Once that issue is resolved/explained, change the expression
to DateDiff("h", [Start Time], [End Time])

Or maybe just change your existing expression to:
((([End Time]-[Start Time])*24)*60) \ 60
so that it returns an integer result.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top