Hello all, I am trying to write code that would automatically assign a training year depending on when an employee was hired and for some reason I cannot get it to work.
Here is what I am looking to do:
In our form, we want to automate the training year.
So what I've done is pulled the Hire date into this form and when a person assigns training to a new employee I have selected the On Update and my code is:
If me.Hiredate >#9/30/10 Then me.trainingyear = #1/1/2010#
Elseif me.Hiredate<#10/1/10# Then Me.trainingyear = #1/1/2011#
ElseIf me.hiredate>#9/30/11# Then me.trainingYear = #1/1/2011#
ElseIf me.hiredate>#10/1/11# Then me.trainingyear=#1/1/12#
and so on.
This would pull up the first two dates fine, but if I tested a hire date of 10/1/11 it would give me 1/1/11 and not 1/1/12
So then I tried a between statement, and that didn't even work at all, I kept getting an error needing a sub or function.
Anyhelp would be great. I know that my If statment isn't very good, so if you have advice on how to make it better, I would sure appreciate it.
Thanks!
Julie
Here is what I am looking to do:
In our form, we want to automate the training year.
So what I've done is pulled the Hire date into this form and when a person assigns training to a new employee I have selected the On Update and my code is:
If me.Hiredate >#9/30/10 Then me.trainingyear = #1/1/2010#
Elseif me.Hiredate<#10/1/10# Then Me.trainingyear = #1/1/2011#
ElseIf me.hiredate>#9/30/11# Then me.trainingYear = #1/1/2011#
ElseIf me.hiredate>#10/1/11# Then me.trainingyear=#1/1/12#
and so on.
This would pull up the first two dates fine, but if I tested a hire date of 10/1/11 it would give me 1/1/11 and not 1/1/12
So then I tried a between statement, and that didn't even work at all, I kept getting an error needing a sub or function.
Anyhelp would be great. I know that my If statment isn't very good, so if you have advice on how to make it better, I would sure appreciate it.
Thanks!
Julie
Last edited: