Once a correct Tuesday or Thursday date has been selected or entered, clicking the Schedule
Appointment button creates three Outlook items: an appointment for the employee, an appoint-
ment for the supervisor (the person the employee reports to), and a task for the supervisor. The
button’s Clickevent procedure is listed as follows:
Private Sub cmdScheduleAppt_Click()On Error GoTo ErrorHandlerDim appOutlook As Outlook.Application
Dim strEmployeeName As String
Dim strSupervisorName As String
Dim appt As Outlook.AppointmentItem
Dim fldTopCalendar As Outlook.Folder
Dim fldContactCalendar As Outlook.Folder
Dim fldSupervisorCalendar As Outlook.Folder
Dim fldTasks As Outlook.Folder
Dim tsk As Outlook.TaskItem
Dim nms As Outlook.NameSpaceSet appOutlook = GetObject(, “Outlook.Application”)
Set nms = appOutlook.GetNamespace(“MAPI”)Set variables for information to be exported to Outlook:
strTitle = “Missing Information”If IsDate(Me![txtNextReviewDate].Value) = True Then
dteNextReviewDate = CDate(Me![txtNextReviewDate].Value)
Else
strPrompt = _
“No next review date; can’t create appointment”
MsgBox strPrompt, vbOKOnly + vbExclamation, strTitle
GoTo ErrorHandlerExit
End IfstrEmployeeName = Me![FirstNameFirst]
strSupervisorName = Nz(Me![cboReportsTo].Column(1))If strSupervisorName = “” Then
strPrompt = “No supervisor selected; can’t schedule review”
strTitle = “No supervisor”
MsgBox strPrompt, vbOKOnly + vbExclamation, strTitle
GoTo ErrorHandlerExit
End IfOrganizing and Communicating with Outlook 4