please i want some help in this problem by using code

Ù

ياسر

i want to calculate the following using code in the form or by Ex builder:
I work in company that takes 2 days for weekend it's Friday and Saturday
and all the holidays that may be more than one day such as Eid El Adha
is more than 3 days continuously.
So i made a form for entering the vacation for each employee in the company
like the following :
the main form :
Emp name , Department , and then the sub form like the following:
Date from , Period , Date to , kind of vacation
So how to calculate the vacations days for the emp without counting any of
the weekend days or holidays that's may be more than 3 or 4 days as i said
before.
like : emp takes 10 days vacation from 1/12/2008 To 10/12/2008 so there is
Friday and Saturday counted i don't want them to be counted so the condition
is that the Emp vacation is to be ended in 12/12/2008 or if there is any
other holidays in between the vacation for the Employee
every employee has an account limit for the vacation its 21 days for
whom have experience for 1 year To 10 years for the current year OR 30 days
for whom that have experience more than 10 years or more every current year
So I need to calculate the days that he toke throw the current year as i
wrote before .
is there any way to do by using the form with sub form that i made above
main form contains the information for the Employee
sub form contains the processing for the vacations details
date from - period - date to - kind of the vacation
 
A

Arvin Meyer [MVP]

The code for what you want to do is at:

http://www.datastrat.com/Code/GetBusinessDay.txt

2 caveats:

1. The function name is GetBusinessDay. You may want to change the function
name.
2. The function works by returning the day in American format (mm/dd/yyyy),
and expects the input in American format. That isn't as much of a problem
with dates greater than the 12th of the month, but Access will return Sept.
6, 2008 for 9/1/08 (NOT 9 January 2008)
 
D

Douglas J. Steele

To get around the second issue Arvin describes, change the lines of code

rst.FindFirst "[HolidayDate] = #" & datStart & "#"

to

rst.FindFirst "[HolidayDate] = " & Format(datStart, "\#yyyy\-mm\-dd\#")


--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)
 

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