Access.2007.VBA.Bibl..

(John Hannent) #1
FIGURE 7.11
Date information automatically filled in after selecting an employee.

The CurrentWeekEndingand FillDateControlsprocedures are listed as follows:

Public Function CurrentWeekEnding() As Date

On Error GoTo ErrorHandler

Dim dteToday As Date

dteToday = Date
Do While Weekday(dteToday) <> vbSunday
dteToday = dteToday - 1
Debug.Print “Testing “ & dteToday
Loop

CurrentWeekEnding = dteToday

ErrorHandlerExit:
Exit Function

ErrorHandler:
MsgBox “Error No: “ & Err.Number & “; Description: “ &
Err.Description
Resume ErrorHandlerExit

End Function

Part II Writing VBA Code to Exchange Data between Office Components

Free download pdf