469,903 Members | 1,631 Online

# Help Please!!

HI all!!

Does anybody knows a function that will allow me to do the following
in a form:

StartTime StopTime TotalHours NO LUNCH(this is a Check Box)
8:00 03:00pm 07:00

The Problem is that if the employee check "NO LUNCH"; 30 minutes has
to be add it to Total Hours. In this case, if the employee check "NO
LUNCH" total hours will be 07:30. It seems very simple, but I don't
have any experience in Access2000. Also, If there is any function,
does the function will go into the click event or Afterupdate event???
Here is the Data/type of those fields?
startTime= Date/time
StopTime= Date/time
TotalHours= text
NOLUNCH= Yes/NO

Thanks in advanced.
Nov 12 '05 #1
3 1525
On 13 Apr 2004 06:40:20 -0700, christian wrote:
HI all!!

Does anybody knows a function that will allow me to do the following
in a form:

StartTime StopTime TotalHours NO LUNCH(this is a Check Box)
8:00 03:00pm 07:00

The Problem is that if the employee check "NO LUNCH"; 30 minutes has
to be add it to Total Hours. In this case, if the employee check "NO
LUNCH" total hours will be 07:30. It seems very simple, but I don't
have any experience in Access2000. Also, If there is any function,
does the function will go into the click event or Afterupdate event???

Here is the Data/type of those fields?
startTime= Date/time
StopTime= Date/time
TotalHours= text
NOLUNCH= Yes/NO

Thanks in advanced.

In a query:
TotalHours:
DateDiff("n",[StartTime],DateAdd("n",Abs([Check])*30,[EndTime]))/60

In an unbound control's Control Source:
=DateDiff("n",[StartTime],DateAdd("n",Abs([Check])*30,[EndTime]))/60

Because a Yes/No field value is either -1 or 0, you can add either 0
or 30 minutes to the EndTime and divide by 60 minutes to get the
result in hours. The ABS() function makes the number a positive value.
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
Nov 12 '05 #2
Thanks Fred for your reply. The function works, but it alters the
functionality of the other fields.I get this in my totalHours field
#NAME?

Do you have any other suggestions??

Thanks,once again.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #3
cristian sepulveda wrote:
Thanks Fred for your reply. The function works, but it alters the
functionality of the other fields.I get this in my totalHours field
#NAME?

Do you have any other suggestions??

Thanks,once again.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Change his Check to NoLunch.

Nov 12 '05 #4

### This discussion thread is closed

Replies have been disabled for this discussion.

### Similar topics

 5 posts views Thread by duikboot | last post: by 1 post views Thread by LilleSkutt | last post: by 14 posts views Thread by TrvlOrm | last post: by 3 posts views Thread by radioman | last post: by 23 posts views Thread by Jason | last post: by 1 post views Thread by Chua Wen Ching | last post: by 4 posts views Thread by steroche | last post: by 28 posts views Thread by Tim_Mac | last post: by 2 posts views Thread by Richard | last post: by reply views Thread by uno7031 | last post: by reply views Thread by eddparker01 | last post: by 1 post views Thread by isladogs | last post: by reply views Thread by Trystan | last post: by reply views Thread by Trystan | last post: by reply views Thread by xarzu | last post: by 1 post views Thread by Waqarahmed | last post: by 2 posts views Thread by Waqarahmed | last post: by reply views Thread by Salome Sato | last post: by 9 posts views Thread by anoble1 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.