misuser2k7
MIS
I am trying to automate the process of creating an Outlook calendar appointment by clicking on a command button placed on an Access Form.
Here is the code for it:
------------------------------------------------------------------------------------------------
Private Sub cmdAddApptToOutlook_Click()
Dim olApp As Outlook.Application
Dim olappt As Outlook.AppointmentItem
Set olApp = CreateObject("Outlook.Application")
Set olappt = olApp.CreateItem(olAppointmentItem)
Set olappt = olApp.CreateItem(1)
With olappt
.Start = Nz(Me.StartDate, vbNullString) & " " & Nz(Me.StartTime, vbNullString)
.Duration = Nz(Me.ApptDuration, 0)
.Subject = Nz(Me.ApptSubject, vbNullString)
.Body = Nz(Me.ApptBody, vbNullString)
.Location = Nz(Me.ApptLocation, vbNullString)
If Me.chkApptReminder = True Then
If IsNull(Me.ReminderMinutes) Then
Forms!frm_ApptForm.ReminderMinutes.Value = 30
End If
.ReminderOverrideDefault = True
.ReminderMinutesBeforeStart = Me.ReminderMinutes
.ReminderSet = True
End If
Set olappt = Nothing
Set olApp = Nothing
MsgBox "Appointment has been Added!", vbInformation
End With
End Sub
---------------------------------------------------------------------------------------------------------------
The code works and even displays the "Appointment has been Added!" message in a couple of seconds after clicking on the command button but no appointment is created in Outlook calendar!
I have tried both early and late binding AND also referenced the Outlook object library in the VBA editor but no appointment is created!
Please help me with this issue. Thank you.