Need VBA for Access

Job ID: 35771493

Budget: ₹1,500 – ₹12,500 INR

This is a little job on a little form. I have a table that tracks PTO (Paid Time Off) hours for our staff. I need some vba code in this form that will calculate the total number of hours of time off.

On my form I have 5 fields.

PTODateStart [The day PTO begins]

PTOTimeStart [The time PTO begins]

PTODateEnd [The day PTO ends]

PTOTimeEnd [The time PTO ends]

TotalHours [The calculated number of hours missed]

TotalHours will calculate the total number of hours. The result will be a negative number.

After the user enters data in all 4 DateTime fields, the TotalHours field will be calculated.

Weekends are to be disregarded. So (for example) if one of our staff takes PTO from Friday at 8:00 AM until the next Monday at 5:00 PM, only 2 days worth of PTO (16 hours) will be charged.

Holidays are also to be disregarded, like weekends, if a holiday occurs during the span of a PTO event. There is a table called tblPTOHolidays that contains the dates of our office holidays in 2003. ***NOTE*** Not all holidays are all-day. For example, the day before Thanksgiving, our office closes at noon. So when calculating the hours, be sure to keep that in mind.

I have attached a .zip file of the little database containing a form for you to use when developing. The real PTO form in our database is much more sophisticated, but for purposes of this job, I have created this little development form.