I am nto so hot at VBA so this is probably a mess.. but what I am attempting to do is use this function to populate a field in a query.. but i get the runtime error 424 Object Required.. there are more elseif statements but they are all the same format and context.. any ideas?
Code:
Public Function hourtotalprogress()
If (student_info.[grad_year] - Year(Now()) = 0) And (Month(Now()) = 1) Then
studenthourtotals.[datehoursneeded] = (studenthourtotals.[Hours Req] / 48)
ElseIf (student_info.[grad_year] - Year(Now()) = 0) And (Month(Now()) = 2) Then
studenthourtotals.[datehoursneeded] = (studenthourtotals.[Hours Req] / 48) * (1 * Month(Now()))
ElseIf (student_info.[grad_year] - Year(Now()) = 0) And (Month(Now()) = 3) Then
studenthourtotals.[datehoursneeded] = (studenthourtotals.[Hours Req] / 48) * (1 * Month(Now()))
ElseIf (student_info.[grad_year] - Year(Now()) = 0) And (Month(Now()) = 4) Then
studenthourtotals.[datehoursneeded] = (studenthourtotals.[Hours Req] / 48) * (1 * Month(Now()))
ElseIf (student_info.[grad_year] - Year(Now()) = 0) And (Month(Now()) = 5) Then
studenthourtotals.[datehoursneeded] = (studenthourtotals.[Hours Req] / 48) * (1 * Month(Now()))
ElseIf (student_info.[grad_year] - Year(Now()) = 0) And (Month(Now()) = 6) Then
studenthourtotals.[datehoursneeded] = (studenthourtotals.[Hours Req] / 48) * (1 * Month(Now()))
End If
End Function