Ik heb een code gekoppeld aan een knop om een access record automatisch in outlook agenda op te slaan. Dit lukt perfect al wil ik bij reminder niet enkel in minuten weergeven maar ook in uren dagen en weken... Kan ik mijn code aanpassen zodat dit lukt?
Alvast bedankt
groeten
Code:
Private Sub Outlook_Check()
If Me!AddedToOutlook = True Then
MsgBox "This appointment already added to Microsoft Outlook"
Exit Sub
Else
Dim olApp As Outlook.Application
Dim OutAppt As Outlook.AppointmentItem
If isAppThere("Outlook.Application") = False Then ' Outlook is not open, create a new instance
Set outobj = CreateObject("Outlook.Application")
Else ' Outlook is already open--use this method
Set olApp = GetObject(, "Outlook.Application")
End If
Set OutAppt = olApp.CreateItem(olAppointmentItem)
End Sub
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
Alvast bedankt
groeten