Adding Task to Outlook

  • Thread starter Thread starter gumby
  • Start date Start date
G

gumby

Option Compare Database
Option Explicit

Function AddOutLookTask()
Dim OutlookApp As Outlook.Application
Dim OutlookTask As Outlook.TaskItem
Set OutlookApp = CreateObject("Outlook.Application")
Set OutlookTask = OutlookApp.CreateItem(olTaskItem)
With OutlookTask
.Subject = "Date Case Began: " & [Forms]![frmERLR_Main]!
[DateCaseBegin] & " Action Type: " & [Forms]![frmERLR_Main]!
[ActionType] & " - " & [Forms]![frmERLR_Main]![ERLRAgencyName] & " -
Management POC: " & [Forms]![frmERLR_Main]![ManagementPOC]
.Body = "Issue: " & [Forms]![frmERLR_Main]![ERLRIssue] & " -
Recommendation: " & [Forms]![frmERLR_Main]![ERLRRec]
.ReminderSet = True
'Remind
.ReminderTime = [Forms]![frmReminder]![StartTime]
'Start Date
.StartDate = [Forms]![frmReminder]![StartDateE]
'Due .
.DueDate = [Forms]![frmReminder]![StartDateE]
.ReminderPlaySound = True
'Modify path.
.ReminderSoundFile = "C:\WINNT\Media\Ding.wav"
.Save
End With
End Function


When I call the function to add a task to outlook for the same day as
today and set the reminder time, it puts Sat 12/30/1899 in the
reminder date but the time is correct.


When I call the function for a date in the future, it gets the
reminder date correct, but defualts the time to 08:00AM.


Any ideas?
 
1899 means no valid date value was entered. I have no idea what those fields
you're referencing contain as data, but the standard is to set a date value
using date and time parts with no seconds in the time part and assign that
date value to ReminderTime.

Try it as a test with a hard coded value and see what happens:

.ReminderTime = Now
 
Back
Top