From: Skeletor on 7 Apr 2010 16:44 Hi. I am running Access 2007. I have created a table. "tblAppointments" and a form, "frmAppointments" and have added the following code to the "On Click" event of the "Send to Outlook" button: Private Sub cmdAddAppt_Click() On Error GoTo Add_Err '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 is already added to Microsoft Outlook" Exit Sub 'Add a new appointment. Else Dim objOutlook As Outlook.Application Dim objAppt As Outlook.AppointmentItem Dim objRecurPattern As Outlook.RecurrencePattern Set objOutlook = CreateObject("Outlook.Application") Set objAppt = objOutlook.CreateItem(olAppointmentItem) With objAppt .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 Set objRecurPattern = .GetRecurrencePattern With objRecurPattern .RecurrenceType = olRecursWeekly .Interval = 1 'Once per week .PatternStartDate = #7/9/2003# 'You could get these values 'from new text boxes on the form. .PatternEndDate = #7/23/2003# End With .Save .Close (olSave) End With 'Release the AppointmentItem object variable. Set objAppt = Nothing End If 'Release the Outlook object variable. Set objOutlook = Nothing 'Set the AddedToOutlook flag, save the record, display a message. Me!AddedToOutlook = True DoCmd.RunCommand acCmdSaveRecord MsgBox "Appointment Added!" Exit Sub Add_Err: MsgBox "Error " & Err.Number & vbCrLf & Err.Description Exit Sub End Sub The appointments are sent to my calendar. I have Publish ability to several of my staff's calendars. What I would like to do is have a drop down box on the form with each staff members name (and email address), select a name and have the appointment then sent to their Outlook Calendar. Could you please advise what I need to add to the existing code, or what new code is needed to perform this function? Thank you in advance
|
Pages: 1 Prev: Changing total on one row in Continous Form Next: Change position of acDialog form |