Link to home
Start Free TrialLog in
Avatar of rowejd
rowejdFlag for United States of America

asked on

Add Appointment to Specific Outlook Calendar from Access

I was just able to successfully add an appointment from access to outlook using the general instructions here:

http://www.access-programmers.co.uk/forums/showthread.php?t=31517

However, our setup is like this...We have a call-center where people take sales calls.  They schedule a salesman to go out--and his calendar is the one that must be updated.

The Outlook calendars run off of an Exchange Server, and the salesmens' calendars are shared.

Anyone know how I can take the code I have and modify it to add the appointment to a specific calendar (a salesperson's shared calendar) rather than just the default (mine)?

Thanks!
'I FOLLOWED THIS CODE GENERALLY
 
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

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rowejd

ASKER

perfecto...sorry for the delay.