Reminders In Outlook - almost working

mulu

Melissa
Local time
Today, 01:05
Joined
Feb 2, 2009
Messages
27
Hi there

I am using the following code to send reminders to outllook using acess:


  1. Function AddOutLookTask() Dim appOutLook As Outlook.Application Dim taskOutLook As Outlook.TaskItem Set appOutLook = CreateObject("Outlook.Application") Set taskOutLook = appOutLook.CreateItem(olTaskItem) With taskOutLook .Subject = "This is the subject of my task" .Body = "This is the body of my task." .ReminderSet = True .ReminderTime = DateAdd("n", 2, Now) ' Set to remind us 2 ' minutes from now. .DueDate = DateAdd("n", 5, Now) ' Set the due date to ' 5 minutes from now. .ReminderPlaySound = True 'add the path to a .wav file on your computer. .ReminderSoundFile = "C:\Win95\media\ding.wav" .Save End With End Function

  2. This is working fine, however, i would like to be able to change this code so that the SUBJECT, BODY, AND DATE AND TIME of the task / reminder comes from data entered in the Reminders Form, how would I do this?
Thank you so much
 
Can you reformat your code i.e. remove the numbering and add code tags. It's really difficult to read as it is.

Chris
 
Function AddOutLookTask() Dim appOutLook As Outlook.Application Dim taskOutLook As Outlook.TaskItem Set appOutLook = CreateObject("Outlook.Application") Set taskOutLook = appOutLook.CreateItem(olTaskItem) With taskOutLook .Subject = "This is the subject of my task" .Body = "This is the body of my task." .ReminderSet = True .ReminderTime = DateAdd("n", 2, Now) ' Set to remind us 2 ' minutes from now. .DueDate = DateAdd("n", 5, Now) ' Set the due date to ' 5 minutes from now. .ReminderPlaySound = True 'add the path to a .wav file on your computer. .ReminderSoundFile = "C:\Win95\media\ding.wav" .Save End With End Function
 
Code:
Function AddOutLookTask() Dim appOutLook As Outlook.Application Dim taskOutLook As Outlook.TaskItem Set appOutLook = CreateObject("Outlook.Application") Set taskOutLook = appOutLook.CreateItem(olTaskItem) With taskOutLook .Subject = "This is the subject of my task" .Body = "This is the body of my task." .ReminderSet = True .ReminderTime = DateAdd("n", 2, Now) ' Set to remind us 2 ' minutes from now. .DueDate = DateAdd("n", 5, Now) ' Set the due date to ' 5 minutes from now. .ReminderPlaySound = True 'add the path to a .wav file on your computer. .ReminderSoundFile = "C:\Win95\media\ding.wav" .Save End With End Function
Code:
 
Code:
    Function AddOutLookTask()          Dim appOutLook As Outlook.Application          Dim taskOutLook As Outlook.TaskItem          Set appOutLook = CreateObject("Outlook.Application")          Set taskOutLook = appOutLook.CreateItem(olTaskItem)       With taskOutLook           .Subject = "This is the subject of my task"           .Body = "This is the body of my task."           .ReminderSet = True           .ReminderTime = DateAdd("n", 2, Now)  ' Set to remind us 2                                                 ' minutes from now.           .DueDate = DateAdd("n", 5, Now)       ' Set the due date to                                                 ' 5 minutes from now.           .ReminderPlaySound = True            'add the path to a .wav file on your computer.           .ReminderSoundFile = "C:\Win95\media\ding.wav"           .Save       End With      End Function
 
here is a txt attachment with the code...
 

Attachments

I meant like this...

Code:
Function AddOutLookTask()
Dim appOutLook As Outlook.Application
Dim taskOutLook As Outlook.TaskItem
Set appOutLook = CreateObject("Outlook.Application")
Set taskOutLook = appOutLook.CreateItem(olTaskItem)
With taskOutLook
    .Subject = "This is the subject of my task"
    .Body = "This is the body of my task."
    .ReminderSet = True
    .ReminderTime = DateAdd("n", 2, Now) ' Set to remind us 2 ' minutes from now.
    .DueDate = DateAdd("n", 5, Now) ' Set the due date to ' 5 minutes from now.
    .ReminderPlaySound = True 'add the path to a .wav file on your computer.
    .ReminderSoundFile = "C:\Win95\media\ding.wav"
    .Save
End With
End Function

So if you want the body to come from a form textbox, change the .body line to:
.Body = [forms].[myFormName].[myTextBoxName]

etc..

hth
Chris
 
Thank you. When I change the .Body line, it gives me the error:
This object does not support this property or method...
 
So you have a text box on your form called Body? Note that the text box name is sometimes different from the field name in your query/table.

Also, you must have the form open to be able to read it.

Also, I assumed you are referencing a form and not a subform. The syntax for a subform is different

hth
Chris
 
yes, txt box - called Body. text box name same, - wait,... now its working, i changed the "." in between [form].[form name] etc, to an "!" - like this

.Body = [Forms]![frmReminders]![Body]

working fine, thank you

Next issue now, is there maybe a way to make the "body" text box display "client contact" details pulled from the clients form or table, so that when the reminder / task opens in outlook it displays the clients name and tel no?

also, this code is adding 2 duplicate tasks in outlook?
 
yes, txt box - called Body. text box name same, - wait,... now its working, i changed the "." in between [form].[form name] etc, to an "!" - like this

.Body = [Forms]![frmReminders]![Body]
Sorry, my mistake.



Next issue now, is there maybe a way to make the "body" text box display "client contact" details pulled from the clients form or table, so that when the reminder / task opens in outlook it displays the clients name and tel no?

also, this code is adding 2 duplicate tasks in outlook?
Take a look at the DLookup() function.
 

Users who are viewing this thread

Back
Top Bottom