1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
| If Me!AddedToOutlook = True Then
MsgBox "Cette Opération a déjà été enrégistrée dans Outlook"
Exit Sub
Else
Const olTaskItem = 3
Dim appOutLook As Object
Dim taskOutLook As Object
Set appOutLook = CreateObject("Outlook.Application")
Set taskOutLook = appOutLook.CreateItem(olTaskItem)
With taskOutLook
.Subject = Me![TravailDemandé]
.Body = "Bien vouloir suivre ce travail relatif au site: " & Me!SiteCouvert & _
", " & "suivant le Bon de Commande N° " & Me!N°BC & " du " & Me!DateBC & _
" " & "avant le " & Me!DélaiDeRéalisation
.ReminderSet = True
.ReminderTime = DateAdd("d", 2, [DateOpération]) ' Set to remind us 2 days from the entered date of operation
.StartDate = [DateOpération] 'Set by me to indicate the start date of the operation
.DueDate = [DélaiDeRéalisation]
' Set the due date to the deadline for the repairs
.ReminderPlaySound = True
'add the path to a .wav file on your computer.
.ReminderSoundFile = "C:\Sound Do not delete\Windows Ding.wav"
.Save
End With
End If
'Set the AddedToOutlook flag, save the record, display a message.
Me!AddedToOutlook = True
DoCmd.RunCommand acCmdSaveRecord
MsgBox "Opération Enregistrée dans Outlook!"
Exit Sub |
Partager