Date subtraction problem

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi again

I have some code which sets a task & reminder in Outlook, which works well
(thanks Chris!) . However, I can't seem to get the Reminder Date to set
correctly. What I want is for the Outlook Reminder Date to be set two days in
advance of the Due Date (which works fine), but it just sets to the same as
the Due Date which is not correct. Where am I going wrong? Fairly new to
coding, so be patient - I've posted my code below:

Dim OutlookApp As Outlook.Application
Dim OutlookTask As Outlook.TaskItem
Dim Subj As String
Dim Prob As String

Set OutlookApp = CreateObject("Outlook.Application")
Set OutlookTask = OutlookApp.CreateItem(olTaskItem)

Subj = "Helpdesk Call Reminder - Call Ref: TE(" & Me.Call_Ref & ")" &
vbCrLf & "User: " & Me.UserName & vbCrLf & "Problem Summary: " &
Me.Problem_Summary
Prob = Me.Problem_History

With OutlookTask
.Subject = Subj
.Body = Prob
.ReminderSet = True
.ReminderTime = DateAdd("d", -2, Me.Target_Date)
.DueDate = DateAdd("d", 0, Me.Target_Date)
.ReminderPlaySound = False
.ReminderSoundFile = "C:\Windows\Media\Ding.wav"
.Save
End With


Many thanks in advance

Martyn

Access 2000
Outlook 2000
Windows 2003 server over Citrix PS
 
Hi

Does not work for me - I tried 2880 and -2880 with the interval type set to
"n" for minutes, but to no avail - it still sets the date the same as the Due
Date.


Martyn
 
Sorry abou that I didn't test it. Set your DueDate before the ReminderTime
that works.
 
Sorted it!

The code was in the wrong order! I wondered if it was possible the Due Date
was overriding the ReminderSet and ReminderTime properties, and it was -
D'oh! The code works exactly as wanted as follows:

With OutlookTask
.Subject = Subj
.Body = Prob
.DueDate = DateAdd("d", 0, Me.Target_Date)
.ReminderSet = True
.ReminderTime = DateAdd("d", -2, Me.Target_Date)
.ReminderPlaySound = False
.ReminderSoundFile = "C:\Windows\Media\Ding.wav"
.Save
End With

Regards
Martyn
 
Sorry, meant to say many thanks Ralph for your eagle eyes spotting that!

Best regards
Martyn
 
Back
Top