Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access / Outlook question

Status
Not open for further replies.

KiaruB

Technical User
Apr 5, 2005
35
DE
Hello,

Can i send a task from Access directly to the Outlook folder : TASKS ?

for example : i'm working on some client data in my Dbase.
when i stop working on it, i want to be able to klick a button that sends this client number and the due date to the outlook folder : tasks so that outlook can remind me to
finish that job.

If yes, please send me in the right direction on how to
do this.

Thanks.
 
Hi

I don't have any examples to show you but I imagine your best bet would be to add Outlook as a reference and then use the Outlook object library to code it. Maybe do a google for Outlook.Application and tasks...

Good luck
 
Hello,

Yes you can send tasks to outlook, like this...

obviously you need to substitute the variables i use (sSubject, sBody, sWho) for the data you require.

Code:
    Dim objOL As New Outlook.Application
    Dim objOLTask As Outlook.TaskItem

Set objOLTask = objOL.CreateItem(olTaskItem)

    With objOLTask
        .Subject = sSubject
        .StartDate = Date
        .DueDate = sDueDate
        .Importance = olImportanceHigh
        .Body = sBody
        .Status = olTaskInProgress
        .Complete = False
        
        .Assign
        .Recipients.Add "" & sWho & ""
        .Send

        .ReminderTime = Date + 1 & Space(1) & "09:00 AM"
        .Save
    End With
 
(i'll just add to 1DMF's comment)
I would add a button to your form called cmdCreateTask
for then ONCLICK event of the button, add something like this:


(notes:
1. REPLACE ALL RED TEXT WITH THE NAMES OF THE CONTROLS FROM YOUR FORM.
2. i made the client number text instead of a number just in case you use text as well in the ID).
3. you should probably check that the controls for CLIENTNUM and DATEDUE are not null/empty. i didn't include that code.



Private Sub cmdCreateTask_Click()
On Error GoTo Err_cmdCreateTask_Click


dim strClientNum as string
Dim dtDue as date

strClientNum = me!ControlNameforClientNum.value
dtDue = Me!!ControlNameforDateDue.value

Call CreateTask(strClientNum, dtDue)

Exit_cmdCreateTask_Click:
Exit Sub

Err_cmdCreateTask_Click:
MsgBox Err.Description
Resume Exit_cmdCreateTask_Click

End Sub


then create a MODULE called CreateTask:

Public Sub CreateTask(strClientNum as string, dtDue as date)



Then add the code 1DMF provided.
with the following changes:
FOLLOWING THE DIM statements add:

Dim strAddress as string
strAddress = "YourFullEmailAddress@XXx.com"


Then Edit these statements in his code to be as shown below:

.datedue = dtDue
.body = strClientNum
.Recipients.ADD(strname)


- laurel

 
Correction - TYPO:
search for two bangs (!!) in the onclick event CODE i provided for your button and make it only one.
should be:

dtDue = Me!ControlNameforDateDue.value

NOT:
dtDue = Me!!ControlNameforDateDue.value
 
Thanks for all the great help !

It works great
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top