Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Attendance Calendar questions Continuing thread702-1723375 2

Status
Not open for further replies.

stevief46

Technical User
Aug 14, 2008
17
US
I have run into an issue with the frm_YearCalendar month of Decembember :) When I went back and checked the original db I found that it also has this problem.

When I click on a date to enter an absence I get a Run-time error '13': Type mismatch. When I click on debug the following (image below) comes up. It is only the month of December. Can you tell me what I should be looking for to fix it?

Thanks in advance for your help
 
 http://files.engineering.com/getfile.aspx?folder=e954355e-100c-4d81-b69b-1b1ef8dc6b27&file=debug_result.JPG
So I think the functions I gave you are correct for what you need. It gives the actual word days. Then you can use something like this to get the accrual. Both functions can be called from a query

Code:
Public Function LeaveAccrual(empID As Long) As Double
  Dim DateOfHire As Date
  Dim YearsOfService
  DateOfHire = DLookup("EmpDateOfHire", "tbluEmployees", "EmployeeID = " & empID)
  YearsOfService = DateDiff("yyyy", DateOfHire, Now)
  'Debug.Print YearsOfService
  'Smarter thing would be to have a table that holds the
  'Accrual rates, but I will hard code them
  Select Case YearsOfService
    Case 0 To 6
      LeaveAccrual = 0.8
    Case 6 To 14
      LeaveAccrual = 1.25
    Case Is > 15
      LeaveAccrual = 1.5
  End Select
End Function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top