.Send method not working? (1 Viewer)

etk

Registered User.
Local time
Today, 07:31
Joined
May 21, 2011
Messages
52
Hi, I have a module in my database that creates an appointment based on a table of sessions. The module works in all respects, except two:

1) When I declare optional attendees it sometimes shows them as required attendees in the actual meeting in outlook, but not always
2) The .Send method does not seem to work. It creates the appointment on my calendar as the originator of the appointment, but does not send to the other recipients.

Can anyone shed some light on these two problems? Below is the code:
Code:
Private Sub SchedOutlook()

Dim rsEmployee As DAO.Recordset
Set rsEmployee = CurrentDb.OpenRecordset("Select * FROM Employee INNER JOIN tblSession ON Employee.EmpID = tblSession.EmpID;", dbOpenDynaset)
Dim rsMentor As DAO.Recordset
Set rsMentor = CurrentDb.OpenRecordset("Select * FROM Employee INNER JOIN tblSession ON Employee.EmpID = tblSession.MentorID;", dbOpenDynaset)
Dim rsSession As DAO.Recordset
Set rsSession = CurrentDb.OpenRecordset("SELECT * FROM tblSession WHERE HR_Apprvd = True AND Apt_in_outlk = False AND Cancelled = False;", dbOpenDynaset)

    With rsSession
        rsSession.MoveFirst
        Do Until rsSession.EOF
            Dim outobj As Outlook.Application
            Dim outappt As Outlook.AppointmentItem
            Set outobj = CreateObject("outlook.application")
            Set outappt = outobj.CreateItem(olAppointmentItem)
            With outappt
               .Start = rsSession!Session_DT & " " & rsSession!Start_Time
               .Duration = rsSession!Session_Duration
               .RequiredAttendees = rsEmployee!Email_Address & "; " & rsMentor!Email_Address
               .OptionalAttendees = rsEmployee!Manager_Email
               .Subject = "Test Appointment"
               .Body = "This is a test"
               .Location = "Test"
               .ReminderMinutesBeforeStart = 15
               .ReminderSet = True
               .Save
               .Send
            End With
                If rsSession!Apt_in_outlk = False Then
                    rsSession.Edit
                    rsSession!Apt_in_outlk = True
                    rsSession.Update
                End If
            rsSession.MoveNext
        Loop
    End With
    
    rsSession.Close
    Set rsSession = Nothing
            
End Sub
 

MarkK

bit cruncher
Local time
Today, 06:31
Joined
Mar 17, 2004
Messages
8,186
Re: 2), I think all "send" does is place the item in the Outbox. You then need to issue a "send/receive," which is a different operation. This is the same behavior you get in outlook when you click the send button on an email. It just moves the item to the outbox.
 

etk

Registered User.
Local time
Today, 07:31
Joined
May 21, 2011
Messages
52
That's the funny thing. It doesn't send to the outbox either. It only places the appointment on my calendar as the originator.
 

etk

Registered User.
Local time
Today, 07:31
Joined
May 21, 2011
Messages
52
resolved the problem. It seems an AppointmentItem by itself will not send to the recipients. It needs to be declared a meeting using:

Code:
.MeetingStatus = olMeeting
 

MarkK

bit cruncher
Local time
Today, 06:31
Joined
Mar 17, 2004
Messages
8,186
Thanks for posting back with the solution!
 

Users who are viewing this thread

Top Bottom