Hello all,
I’m beginning to get a pretty good foundation in VBA, but I can’t wrap my head around this problem, even after trolling around the net searching through other posts that seemed remotely related. So I am hopeful that some (always) awesome and helpful Bytes brain power can be thrown my way.
If it’s even possible, I would like to be able to count the vacation dates that my employees have taken consecutively (doesn’t matter if they are holidays or on the weekend, just all days listed as vacation and taken consecutively).
In a form titled [frmVacations], I have a subform titled [tblVacationsubf orm] which allows me to input and show vacation dates taken or scheduled for each employee. The relevant fields in the subform are titled [EmployeeName], [VacationType] from which I can choose v/d (for vacation day) d/d (for discretionary day) s/o (for scheduled off day) etc…. I’m only concerned about counting “v/d”. And lastly of course I have a field [VacationDate]. The subform is pulling it’s information from a table titled [tblVacations].
The reason for this being that, for example, if an employee has 10 years with the company he/she gets 4 weeks of vacation. 2 of these weeks can be broken up and taken in intermittent individual days, but the other 2 weeks needs to be taken together in solid blocks (i.e 5 days taken consecutively). So this is needed in order to keep better track and make sure the employee isn’t accidently breaking up more vacation weeks than is allowed.
I already have a text box able to comb through a query titled [tblVacations vac query] and count how many “v/d” are taken for each employee, but I would love to have a text box (which I have created and titled [txtConsecDays] ) be able to look through the table/recordset or query and count how many days are being taken consecutively in blocks of 5. My ultimate goal would be to have a text box reflect “1” (week) if an employee has taken 5 days together consecutively, and then “2” (weeks) if they have taken another 5 days together after that, etc... This would make things so much easier to track and avoid slip ups when scheduling vacations for over 30 employees.
I do have employees who only work 4 days a week, and therefore a vacation week for them obviously only consists of a block of 4 days, but this is a problem I would try to tackle later when/ if someone can help me with this first main problem.
Hopefully I’ve been clear in what I need and have included all the information needed if this scenario is even possible to implement. I did try to mess around with queries for this problem but again seemed to be running in circles, and ultimately realized this problem probably had to be done in VBA. As always, I really appreciate any insights and suggestions anyone can help with.
I’m beginning to get a pretty good foundation in VBA, but I can’t wrap my head around this problem, even after trolling around the net searching through other posts that seemed remotely related. So I am hopeful that some (always) awesome and helpful Bytes brain power can be thrown my way.
If it’s even possible, I would like to be able to count the vacation dates that my employees have taken consecutively (doesn’t matter if they are holidays or on the weekend, just all days listed as vacation and taken consecutively).
In a form titled [frmVacations], I have a subform titled [tblVacationsubf orm] which allows me to input and show vacation dates taken or scheduled for each employee. The relevant fields in the subform are titled [EmployeeName], [VacationType] from which I can choose v/d (for vacation day) d/d (for discretionary day) s/o (for scheduled off day) etc…. I’m only concerned about counting “v/d”. And lastly of course I have a field [VacationDate]. The subform is pulling it’s information from a table titled [tblVacations].
The reason for this being that, for example, if an employee has 10 years with the company he/she gets 4 weeks of vacation. 2 of these weeks can be broken up and taken in intermittent individual days, but the other 2 weeks needs to be taken together in solid blocks (i.e 5 days taken consecutively). So this is needed in order to keep better track and make sure the employee isn’t accidently breaking up more vacation weeks than is allowed.
I already have a text box able to comb through a query titled [tblVacations vac query] and count how many “v/d” are taken for each employee, but I would love to have a text box (which I have created and titled [txtConsecDays] ) be able to look through the table/recordset or query and count how many days are being taken consecutively in blocks of 5. My ultimate goal would be to have a text box reflect “1” (week) if an employee has taken 5 days together consecutively, and then “2” (weeks) if they have taken another 5 days together after that, etc... This would make things so much easier to track and avoid slip ups when scheduling vacations for over 30 employees.
I do have employees who only work 4 days a week, and therefore a vacation week for them obviously only consists of a block of 4 days, but this is a problem I would try to tackle later when/ if someone can help me with this first main problem.
Hopefully I’ve been clear in what I need and have included all the information needed if this scenario is even possible to implement. I did try to mess around with queries for this problem but again seemed to be running in circles, and ultimately realized this problem probably had to be done in VBA. As always, I really appreciate any insights and suggestions anyone can help with.
Comment