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 ErrorHandler
Dim 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.NameSpace
Set 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 If
strEmployeeName = 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 If
Organizing and Communicating with Outlook 4