Problem with sending to outlook (1 Viewer)

coolcatkelso

Registered User.
Local time
Today, 10:38
Joined
Jan 5, 2009
Messages
279
Hiya guys

I'm trying to send some data to the Outlook 2007 calander, everything works perfectly apart from, access is telling it to repeat the added appointment every week.

Here the code that I got my Microsoft site

Code:
Private Sub Command23_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!ApptStartDate & " " & 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
                'You can hard-wire in these dates or get the
                'information from text boxes, as used here.
                '.PatternStartDate = #12/1/2003#
                .PatternStartDate = Me!ApptStartDate
                '.PatternEndDate = #12/30/2003#
                .PatternEndDate = Me!ApptEndDate
            End With
            .Save
            .Close (olSave)
            End With
            'Release the AppointmentItem object variable.
            Set objAppt = Nothing
    End If
    'Release the object variables.
    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

Dunno what to change to cancel the Recurrence?

Also - Is there some sort of delay when sending to outlook?

Office 2007
Windows 7
________
Iolite vaporizer schematics
 
Last edited:

boblarson

Smeghead
Local time
Today, 02:38
Joined
Jan 12, 2001
Messages
32,059
Well, modifying this might do the trick:
Code:
            With objRecurPattern
                [COLOR="Red"][B].RecurrenceType = olRecursWeekly[/B][/COLOR]
                .Interval = 1
                'Once per week
                'You can hard-wire in these dates or get the
                'information from text boxes, as used here.
                '.PatternStartDate = #12/1/2003#
                .PatternStartDate = Me!ApptStartDate
                '.PatternEndDate = #12/30/2003#
                .PatternEndDate = Me!ApptEndDate
            End With
 

coolcatkelso

Registered User.
Local time
Today, 10:38
Joined
Jan 5, 2009
Messages
279
Hi Bob

Cheers for the quick reply

I've tried to change it to .RecurrenceType = olRecursNever

But it still shows up as a recurrence

Any suggestions?
________
Easy q vaporizer
 
Last edited:

Users who are viewing this thread

Top Bottom