Question : Ms Access/Outlook Appointment system

Hey ive seen quite a few similar things to this posted but coulnt get any of them to work, basically we have a database that at the moment holds all of our customer information in and we want to build a system where we can put appointments in our external salespersons outlook tasks... i have this code which works

Private Sub AddAppt_Click()

DoCmd.RunCommand acCmdSaveRecord

If Me!AddedToOutlook = True Then
MsgBox "This appointment already added to Microsoft Outlook"
Exit Sub

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

Set outobj = Nothing

Me!AddedToOutlook = True
DoCmd.RunCommand acCmdSaveRecord
MsgBox "Appointment Added!"
Exit Sub
AddAppt_Err:
MsgBox "Error " & Err.Number & vbCrLf & Err.Description
Exit Sub
End Sub

how can i add who i want to send it to (Recipient) into this code as at the minute this code just adds an appointment to myn but i want to specify who it goes to???

Thanks in Advance

Answer : Ms Access/Outlook Appointment system

From the standard Outlook automation code found here:
http://support.microsoft.com/kb/161088


Obviously you will have to adjust for your unique Object Names.

(I am sure you get the idea)
;-)


' Add the CC recipient(s) to the message.
              Set objOutlookRecip = .Recipients.Add("Some Name")
              objOutlookRecip.Type = olCC

' Resolve each Recipient's name.
             For Each ObjOutlookRecip In .Recipients
                 objOutlookRecip.Resolve
             Next


JeffCoachman
Random Solutions  
 
programming4us programming4us