Question : Send MS Access Appointments to Outlook Calendar - Detertmine Changes in Access to Outlook

Hi,

I have a MS Access 2003 DB that can talk to a Outlook calendar, by using this code
from
http://www.access-programmers.co.uk/forums/showthread.php?t=31517


Private Sub AddAppt_Click()
' Save record first to be sure required fields are filled.
DoCmd.RunCommand acCmdSaveRecord
' Exit the procedure if appointment has been added to Outlook.
If Me!AddedToOutlook = True Then
MsgBox "This appointment already added to Microsoft Outlook"
Exit Sub
' Add a new appointment.
Else
Dim outobj As Outlook.Application
Dim outappt As Outlook.AppointmentItem
Set outobj = CreateObject("outlook.application")
Set outappt = outobj.CreateItem(olAppointmentItem)
With outappt
.Start = Me!ApptDate & " " & Me!ApptTime
.Duration = Me!ApptLength
.Subject = Me!Appt
If Not IsNull(Me!ApptNotes) Then .Body = Me!ApptNotes
If Not IsNull(Me!ApptLocation) Then .Location = _
Me!ApptLocation
If Me!ApptReminder Then
.ReminderMinutesBeforeStart = Me!ReminderMinutes
.ReminderSet = True
End If
.Save
End With
End If
' Release the Outlook object variable.
Set outobj = Nothing
' Set the AddedToOutlook flag, save the record, display a message.
Me!AddedToOutlook = True
DoCmd.RunCommand acCmdSaveRecord
MsgBox "Appointment Added!"
Exit Sub
AddAppt_Err:
MsgBox "Error " & Err.Number & vbCrLf & Err.Description
Exit Sub
End Sub


More or less, I can manage to Add the Appointment, but, if I have to make a Change the contents of the Appt. in Access, I would like to have this Also done in Outlook, so then I do not have to do double entry.

I am thinking a string compare of my fields should do it,before the add event is processed but I have never attempted this before,

and, if I simply remove check box, it double book's the appt, which I do not want.

Do I load a Primary Key(Unique), into the appt, so when it does send it to Outlook, they can both determine that this appt, is for example "Appt#1", before I attempt to write?

Any Thoughts?

Jfer

Answer : Send MS Access Appointments to Outlook Calendar - Detertmine Changes in Access to Outlook

If we start with your code as:

Set outobj = CreateObject("outlook.application")
Set outappt = outobj.CreateItem(olAppointmentItem)
With outappt
.
Then embelish it as in teh snippet you will now be working with the outlook appointment if:

1. It exists
2, You saved the entryid after saving the appt

Chris
1:
2:
3:
4:
5:
6:
7:
8:
Set outobj = CreateObject("outlook.application")
if thesavedentryid = "" then
    Set outappt = outobj.CreateItem(olAppointmentItem)
else
    Set outappt = outobj.session.getitemfromid(thesavedentryid)
end if
With outappt
.
Random Solutions  
 
programming4us programming4us