I can also send a cancelled appointment request from Access to the same individual for the same appointment but for some reason Outlook is not recognising the cancel request as being for the original appointment so when the user (in Outlook) clicks 'remove from calendar' the original appointment is not removed.
Is there something else I need to be sending with the original and cancelled meeting requests?
The code for sending the meeting request is:
Expand|Select|Wrap|Line Numbers
- Private Sub cmdAddAppt_Click()
- On Error GoTo Add_Err
- If Me!TutorID = 3 Then
- MsgBox ("There is no tutor selected to send" & Chr(10) _
- & "a meeting meeting request")
- Exit Sub
- End If
- 'Exit the procedure if appointment has been added to Outlook.
- If Me!ApptmentAdded = True Then
- MsgBox "This appointment is already added to Microsoft Outlook"
- Exit Sub
- 'Add a new appointment.
- Else
- Dim objOutlook As Outlook.Application
- Dim objAppt As Outlook.AppointmentItem
- Dim objDuration As Integer
- Dim objOutlookRecip As Outlook.Recipient
- Set objOutlook = CreateObject("Outlook.Application")
- Set objAppt = objOutlook.CreateItem(olAppointmentItem)
- objAppt.MeetingStatus = Outlook.OlMeetingStatus.olMeeting
- Dim aTemp As Long
- Dim bTemp As Long
- Dim cTemp As Integer
- aTemp = Round((Int(CSng(Me!TimeTo) * 1440)) / 5, 0) * 5
- bTemp = Round((Int(CSng(Me!TimeFrom) * 1440)) / 5, 0) * 5
- cTemp = aTemp - bTemp
- Dim objMessage As String
- Dim strRecip As String
- Dim strSelfLead As String
- strRecip = Me![Tutor Email Address]
- objMessage = "Teaching booking - " & Me![Programme Name] & ", " & Me![Name of Hirer]
- If Me![Self Lead] = -1 Then
- strSelfLead = "Yes"
- Else
- strSelfLead = "No"
- End If
- With objAppt
- Set objOutlookRecip = .Recipients.Add(strRecip)
- objOutlookRecip.Type = olTo
- .Start = Me![Visit Date] & " " & Me!TimeFrom
- .Duration = cTemp
- .Subject = objMessage
- .ReminderMinutesBeforeStart = 15
- .ReminderSet = True
- .Body = "Number of Students: " & Me![Student Total] & vbCrLf _
- & "Number of Adults: " & Me![Adult Total] & vbCrLf _
- & "Self Lead?: " & strSelfLead & vbCrLf _
- & "Level: " & Me!Level
- .Location = Me!Venue
- .Send
- End With
- 'Release the AppointmentItem object variable.
- End If
- 'Release the Outlook object variable.
- Set objAppt = Nothing
- Set objOutlook = Nothing
- Set objOutlookRecip = Nothing
- 'Set the AddedToOutlook flag, save the record, display a message.
- Me!ApptmentAdded = True
- DoCmd.RunCommand acCmdSaveRecord
- MsgBox "Appointment Added!"
- Exit Sub
- Add_Err:
- MsgBox "Error " & Err.Number & vbCrLf & Err.Description
- Exit Sub
- End Sub