Thread: Using DateDiff
View Single Post
  #2 (permalink)  
Old November 27th, 2005, 01:03 AM
bjackman bjackman is offline
Authorized User
Join Date: Nov 2003
Location: Hillsboro, Ohio, USA.
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to bjackman Send a message via MSN to bjackman

add a field to each of the 2 subtables to hold the value of how many days they have taken off. You can then use an after update event on the end date and have it use the datediff function. the syntax would be similiar to this, substitute your field names where appropriate.

datediff (d,me.startdate,me.enddate) the d specifies for it to return days, the date diff function has several different types of data it can return.

This is getting confusing, i'll try to write out all the code, you will need to substitute your field names:

dim totaldays as string

totaldays = datediff( d, me.startdate, me.enddate)

me.newfield.value = totaldays

you can then use an update query to update the total available hours for each employee by subtracting your new field value from their total available. Hope this helps

Reply With Quote