Results 1 to 5 of 5
  1. #1
    lixolin is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2013
    Posts
    6

    Making access create a task in Outlook

    Hello!
    I have a problem with Access that i was hoping to get some help with.



    Im working with a database where I want to create a button in a split form (based on a single table) that when clicked takes the data out of the selected tuple and uses it (selected fields for selected tasks) to create a task in outlook that can then be passed on by the manager (who has access to the databse) to an employee (who only works in outlook).

    I am using Access 2010 and Outlook 2010. I have VERY limited experience with Visual Basic, and programming in general, but i have experimented with different codes i found online, so far unsuccessfully. I do know my way around access pretty well and I understand SQL fairly good as well.

    The table which the form takes the data from is called "Tasks", and the form is called "Tasks2". The field that i want to use for headline is called "Headline" and is a text value. The field i want to use for the description ("main text") of the outlook task is called "Description" and is a memo value Then i have two fields named starting date and finishing date to be used for setting the dates of the outlook task, both in a date-format.

    If you could help me write this i would be for ever thankful

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,624
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    lixolin is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2013
    Posts
    6
    Sadly no, i tried the code, i even tried changing it and kind of mixing it with the code i found earlier, and nothing worked

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,624
    Why not, what happens - error message, wrong results, nothing? The calendar item is not created? I have tested this code and it created calendar item for me.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    lixolin is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2013
    Posts
    6
    I solved it, wooho!
    The problem was in my access settings, it didnt recognise the commands i used, changed it in tools > references by ticking the outlook box.

    My working code after a little bit of re-design on the form became:

    Private Sub Kommandoknapp137_Click()
    Dim olApp As Outlook.Application
    Dim otTask As TaskItem
    Dim ofFolder As MAPIFolder
    Dim onNamespace As NameSpace
    Dim ofInbox As MAPIFolder
    Dim oicItems As Items
    Dim omMail As MailItem
    Dim orpRecurrence As RecurrencePattern
    Dim NowDate As Date
    Dim DateEnd As Date
    Dim DateDif As Long
    Dim Task As Object
    Dim ToContact As Object

    Set Task = Outlook.CreateItem(olTaskItem)
    NowDate = Now()
    If Not IsNull(Förfallodatum.Value) Then
    Task.DueDate = Förfallodatum.Value
    End If
    Task.Subject = Title.Value
    If Not IsNull(Description.Value) Then
    Task.Body = Description.Value
    End If
    Task.Assign
    Set ToContact = Task.Recipients.Add(Epost)
    Task.ReminderSet = True
    Task.Save
    Task.Send
    Form.Close
    End Sub



    probably really clumsy and unefficient code, i just took the pieces that seemed vital from several codes i found, but it did the trick!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 20
    Last Post: 06-27-2012, 02:19 PM
  2. Assigning Outlook task from shared Outlook mailbox
    By Remster in forum Programming
    Replies: 2
    Last Post: 11-16-2011, 04:38 AM
  3. Update Outlook task from Access
    By timg147 in forum Programming
    Replies: 1
    Last Post: 08-16-2010, 12:27 PM
  4. Add task from Access to Outlook
    By Johan in forum Programming
    Replies: 1
    Last Post: 03-31-2010, 09:58 AM
  5. Export Access reports/query results to Outlook Calendar/Task
    By kfinpgh in forum Import/Export Data
    Replies: 0
    Last Post: 02-22-2007, 01:09 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums