Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    Join Date
    Jul 2010
    Posts
    14

    Unanswered: control button to open MSOutlook task?

    Can anyone help with code that will open a new Outlook task?
    Any way to then update the task table "Scheduled?" y/n field to y once the task is scheduled in Outlook?

  2. #2
    Join Date
    May 2010
    Posts
    601
    Quote Originally Posted by DontknowAccess View Post
    Can anyone help with code that will open a new Outlook task?
    Any way to then update the task table "Scheduled?" y/n field to y once the task is scheduled in Outlook?
    Welcome to dbForums.

    See: Using Automation to Add a Task/Reminder to MS Outlook
    Boyd Trimmell aka HiTechCoach HiTechCoach.com (free access stuff)
    Microsoft MVP - Access Expert
    BPM/Accounting Systems/Inventory Control/CRM
    Programming: Nine different ways to do it right, a thousand ways to do it wrong.
    Binary--it's as easy as 1-10-11

  3. #3
    Join Date
    Jul 2010
    Posts
    14
    ok -- I have added a module to add an outlook task, now how do I make the command button run the correct code?

  4. #4
    Join Date
    Jul 2010
    Posts
    14
    by the way I get error #2950 when I point the button to a macro and the macro runs code AddOutLookTask()

  5. #5
    Join Date
    May 2010
    Posts
    601
    Did you place the code to add the task in a standrard code module?

    Did you set the reference to Outlook?
    Boyd Trimmell aka HiTechCoach HiTechCoach.com (free access stuff)
    Microsoft MVP - Access Expert
    BPM/Accounting Systems/Inventory Control/CRM
    Programming: Nine different ways to do it right, a thousand ways to do it wrong.
    Binary--it's as easy as 1-10-11

  6. #6
    Join Date
    Jul 2010
    Posts
    14
    I did the best I could -- I created a module called add task, I typed in exact. Under Option Compare Database I added Option Explicit...down to End With which is followed with End Function.
    Then I created a Macro with one line of Run Code and AddOutLookTask() and assigned the button to run the macro.

    As should be obvious I am a 'business' user not a 'programmer' user, I know where I want to get but I don't know how to get there!

  7. #7
    Join Date
    May 2010
    Posts
    601
    Quote Originally Posted by DontknowAccess View Post
    by the way I get error #2950 when I point the button to a macro and the macro runs code AddOutLookTask()
    I will assume you are using Access 2007 or 2010 According. This error is caused by a macro running in a database that is not trusted. You can either move the database to a trusted location, or trust location of the database.

    See: MS KB article

    and

    Also this visual guide
    Boyd Trimmell aka HiTechCoach HiTechCoach.com (free access stuff)
    Microsoft MVP - Access Expert
    BPM/Accounting Systems/Inventory Control/CRM
    Programming: Nine different ways to do it right, a thousand ways to do it wrong.
    Binary--it's as easy as 1-10-11

  8. #8
    Join Date
    Jul 2010
    Posts
    14
    Thanks, but my db is in a trusted location.

    Here is the code:

    Option Compare Database

    Option Explicit

    Function AddOutLookTask()
    Dim appOutLook As Outlook.Application
    Dim taskOutLook As Outlook.TaskItem
    Set appOutLook = CreateObject("Outlok.Application")
    Set taskOutLook = appOutLook.CreateItem(olTaskItem)
    With taskOutLook
    .Subject = "This is the subject"
    .Body = "This is the body"
    .ReminderSet = True
    .ReminderTime = DateAdd("n", 2, Now)
    .DueDate = DateAdd("n", 5, Now)
    .ReminderPlaySound = True
    .ReminderSoundFile = "C:\Win95\media\ding.wav"
    .Save
    End With
    End Function

    thanks for your assistance by the way, I appreciate it

  9. #9
    Join Date
    May 2010
    Posts
    601
    I put together a little example database for you.

    It is really basic. Will need to add some error handling.

    The attached is in Access 2000 format. It was created and tested with Access 2010/Outlook 2010.
    Attached Files Attached Files
    Boyd Trimmell aka HiTechCoach HiTechCoach.com (free access stuff)
    Microsoft MVP - Access Expert
    BPM/Accounting Systems/Inventory Control/CRM
    Programming: Nine different ways to do it right, a thousand ways to do it wrong.
    Binary--it's as easy as 1-10-11

  10. #10
    Join Date
    Jul 2010
    Posts
    14
    Thanks for the help, I'll give this a go, looks like exactly what I was looking to do.

    Thanks again

  11. #11
    Join Date
    Jul 2010
    Posts
    14
    ok, I copied your module into my database and copied your event procedure for the command button.

    Upon click I get Compile Error: Method or data member not found
    with .txtSubject highlighted in the debugger.

    Do you have a suggested next step for me?

  12. #12
    Join Date
    May 2010
    Posts
    601
    Quote Originally Posted by DontknowAccess View Post
    ok, I copied your module into my database and copied your event procedure for the command button.

    Upon click I get Compile Error: Method or data member not found
    with .txtSubject highlighted in the debugger.

    Do you have a suggested next step for me?
    The .txtSubject is a reference to a control on the sample form.

    You will need to edit the line from:

    Call SetupOutLookTask(Me.txtSubject, Me.txtBody, Me.txtDue, Me.txtReminder)


    replace txtSubject with your control name or text for the subject

    replace txtBody with your control name or text for the body of the reminder

    replace txtDue with your control name or date and time for the Due date and time

    replace txtReminder with your control name or date and time for the Reminder date and time
    Boyd Trimmell aka HiTechCoach HiTechCoach.com (free access stuff)
    Microsoft MVP - Access Expert
    BPM/Accounting Systems/Inventory Control/CRM
    Programming: Nine different ways to do it right, a thousand ways to do it wrong.
    Binary--it's as easy as 1-10-11

  13. #13
    Join Date
    Jul 2010
    Posts
    14

    That Worked

    That did it! I had the right fields to point to for subject/body, and I was able to put two calendars onto the form to pick due and reminder dates, And I got an Outlook task beautifully. Thanks! One more thing, would it be feasible to get it to add an info box that upon click says the task is scheduled and moves the form to the next record when you click OK?

  14. #14
    Join Date
    May 2010
    Posts
    601
    Quote Originally Posted by DontknowAccess View Post
    That did it! I had the right fields to point to for subject/body, and I was able to put two calendars onto the form to pick due and reminder dates, And I got an Outlook task beautifully. Thanks! One more thing, would it be feasible to get it to add an info box that upon click says the task is scheduled and moves the form to the next record when you click OK?
    Yes, that is possible.

    To let the user know that the task was added you could add this:

    MsgBox "Task has been added"
    Boyd Trimmell aka HiTechCoach HiTechCoach.com (free access stuff)
    Microsoft MVP - Access Expert
    BPM/Accounting Systems/Inventory Control/CRM
    Programming: Nine different ways to do it right, a thousand ways to do it wrong.
    Binary--it's as easy as 1-10-11

  15. #15
    Join Date
    Jul 2010
    Posts
    14

    next step

    Hi -- so all the help you have already given me is working beautifully. I am trying to add one more piece.

    The main form (that now speaks to Outlook thanks again) has very little info on it -- these are sales tasks and basically contain customer info and product category info. The sales task is to market this category to this customer.

    The first button schedules the task onto the user's Outlook task list.

    The next button I am working on needs to open a second form showing my product list, filtered to the particular subcategory on the current record from the first form. It would be nice if it also put the customer name into the title box (Price list prepared for CUSTOMER on TODAY's DATE).

    Can anyone suggest how I would go about this?

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
  •