Open the Visual Basic editor.
Select (double click) the AnnLeave VBA module.
Although special dates (such as public holidays) were correctly displayed on the main reports, they were not counted in the total days leave. The VBA function could also cause cause an error if the database is compiled.
VBA module: AnnLeave
VBA function: CountSpecDates(Dfr As Date) As Integer
Cause: There is a reference to a query which does not exist
Old code
Function CountSpecDates(Dfr As Date) As Integer ' This version updated Jul10 Dim Temp As String On Error GoTo MyErrorBit Temp = "[xdate] = #" & Format(Dfr, "dd mmm yy") & "#" CountSpecDates = DCount("[xdateform]", "Specialdates enhanced", Temp) 'Debug.Print Format(Dfr, "dd mmm yy"), CountSpecDates Exit Function MyErrorBit: Resume Next End Function |
Change to new code
Function CountSpecDates(Dfr As Date) As Integer ' This version updated Apr13 Dim Temp As String On Error GoTo MyErrorBit Temp = "[xdate] = #" & Format(Dfr, "dd mmm yy") & "#" CountSpecDates = DCount("[xdate]", "Specialdates", Temp) Debug.Print Format(Dfr, "dd mmm yy"), CountSpecDates Exit Function MyErrorBit: Resume Next End Function |
End
The database can be amended to ignore weekends - for offices which operate 7 day weeks.
Add a new record to the Keydata table containing a Y or N value.
Edit a line in the MakeLeaveTable() program as follows:
Edit a line in the MyWorkdays() function as follows:
End
Should a type of leave get counted as part of the leave total = eg Client Visit? Possibly amend the Reasons table. - OR half days? A new field of DaysLeaveTaken
Office Leave Planner |
an Access database for | Create web page tables with expanding or drill down sections |
file: OffLeaveMaint.htm | Page last updated: Apr13 | CMIDX S0 P0 N | © MeadInKent.co.uk 2013 |