I am trying to switch from a text box that pulls from a table created by a query to one that automatically calculates the information needed. Pulling from the query created table is not ideal due to possible status changes changing the way PTO is calculated. If someone changes from FT to PT (or vice versa), I need their allowed vacation amount to update automatically, rather than having to rerun the query to get it figured out.
This is what I have so far. Yes, I know the syntax I'm using is probably incorrect, but this was done using the nested IIf statements as a guide. And my VB book won't be here until sometime near the end of next week. (Yes, I am one of those who will purchase a manual just to complete one project)
Biggest problem at this point is I don't want PTOyear to have to be in a table somewhere - I'd like to just declare it at some point that PTOyear = 2010 (or 2011 next year, and so on...)
Expand|Select|Wrap|Line Numbers
- If Status.Employees="FT" Then
- If PTOyear-Year(HireDate.Employees)>=20 Then
- AlwdVac.Form1="160"
- Else
- If PTOyear-Year(HireDate.Employees)>=16 Then
- AlwdVac.Form1=(PTOyear-Year(HireDate.Employees))*8
- Else
- IF PTOyear-Year(HireDate.Employees)>=5 Then
- AlwdVac.Form1="120"
- Else
- IF PTOyear-Year(HireDate.Employees)>=2 Then
- AlwdVac.Form1="80"
- Else
- If PTOyear-Year(HireDate.Employees)=1 Then
- If 12-Month(HireDate.Employees)>2 Then
- AlwdVac.Form1="64"
- Else
- AlwdVac.Form1="40"
- Else
- If 12-Month(HireDate.Employees)>2 Then
- AlwdVac.Form1=ROUND((12-Month(HireDate.Employees))*2.67,0)
- Else
- AlwdVac.Form1="0"
- Else
- If Status.Employees="PT" Then
- If PTOyear-Year(HireDate.Employees)>=20 Then
- AlwdVac.Form1="100"
- Else
- If PTOyear-Year(HireDate.Employees)>=16 Then
- AlwdVac.Form1=(PTOyear-Year(HireDate.Employees))*5
- Else
- IF PTOyear-Year(HireDate.Employees)>=5 Then
- AlwdVac.Form1="75"
- Else
- IF PTOyear-Year(HireDate.Employees)>=2 Then
- AlwdVac.Form1="50"
- Else
- If PTOyear-Year(HireDate.Employees)=1 Then
- If 12-Month(HireDate.Employees)>2 Then
- AlwdVac.Form1="40"
- Else
- AlwdVac.Form1="25"
- Else
- If 12-Month(HireDate.Employees)>2 Then
- AlwdVac.Form1=ROUND((12-Month(HireDate.Employees))*1.67,0)
- Else
- AlwdVac.Form1="0"
- Else
- If Status.Employees="ARR" Then
- AlwdVac.Form1="0"
- Else
- If Status.Employees="SAL" THen
- AlwdVac.Form1=""
- 'This needs to be able to be entered manually, as the allowed vacation and personal for Salaried employees can vary
- Else
- AlwdVac.Form1="Status Needed"