calculating from 2 dates

K

Kay Davies

Hello - can anyone help me please

I am trying to calculate the number of day's holiday
someone has taken but subtracting the end date of the
holiday from the start date.

there are two boxes

hol 1 start date
hol 1 end date

then the answer goes into an unbound box on the form which
is automatically filled in as the dates are entered.
Nothing I do seems to work so if anyone has any ideas I
would be grateful

thanks
Kay
 
T

Tony C

You need to use "DateDiff": -

HolidayDays= DateDiff("d", EndDate, StartDate)

HTH


Tony C.
 
K

Kailash Kalyani

There is a built in function called datediff function available that'll do
the subtraction for you.

you need to add an afterUpdate function to both your boxes something like

sub box1_afterupdate ()
dim result as integer
result = datediff("d", box1,box2)
box3.text = result
end sub
 

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