473,395 Members | 1,790 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How to assign an Outlook task with Access

Nauticalgent
100 64KB
Hello all,

I am using Access/Office 2010 on a Windows 7 platform.

What I am trying to do sounds simple: I want to assign an Outlook Task to the individual selected in a form's combo box.

Here is my code that I took from an MSDN site:

Expand|Select|Wrap|Line Numbers
  1. Sub AssignedTech_AfterUpdate()
  2. Dim myOlApp As New Outlook.Application
  3. Dim myItem As Outlook.TaskItem
  4. Dim myDelegate As Outlook.Recipient
  5. Set MyItem = myOlApp.CreateItem(olTaskItem)
  6. MyItem.Assign
  7. Set myDelegate = MyItem.Recipients.Add("Dan Wilson")
  8. myDelegate.Resolve
  9. If myDelegate.Resolved Then
  10. myItem.Subject = "Prepare Agenda For Meeting"
  11. myItem.DueDate = Now + 30
  12. myItem.Display
  13. myItem.Send
  14. End If
  15. End Sub
I do have the Microsoft Outlook 14.0 Object Library referenced and I got a clean compile prior to running the code.

When I select the intended recipients name, I get a "Run-Time Error "287" Application-Defined or Object-Defined Error"

When I debug the code, the portion in bold is the culprit. I have tried different ways of doing this but it doesn't matter what I do, it code tanks at the Recipients.Add line.

Any suggestions?
Apr 15 '16 #1
5 9123
ADezii
8,834 Expert 8TB
Do you actually have a Recipient named Dan Wilson?
Apr 16 '16 #2
Nauticalgent
100 64KB
If only that were the reason...
Apr 16 '16 #3
Nauticalgent
100 64KB
The code is a direct cut and paste from an MSDN site. "Dan Wilson" is what/who they used. I actually substitute it with a valid e-mail address that is in the GAL on our exchange server.

I took this project home and got it to work as written, sans Dan Wilson.

I loaded in it on my Mac (BootCamp). Win 7, Office 2016. It worked like a charm. Outlook freaked out and wanted assurance from me on every MyItem.xxxx occurrence, but once allowed it, the task was sent and all was well.

I was not ready to pop the champagne cork yet, so I went to my trusty Lap top that has Office 2010 and things when well on that platform as well...BUT...it uses Win 10. In other words, I was not able to completely duplicate my working environment.

However, I am satisfied that the code works and that the issues are local settings in Access and Outlook. Not sure how to start "peeling the onion" but I will get there.

Hopefully some insight from this site is forthcoming, once they get bast the "Dan Wilson" bit that is....
Apr 17 '16 #4
twinnyfo
3,653 Expert Mod 2GB
Nauticalgent,

Here is the code I use and I don't have any problems with it. However, instead of using the name on the GAL, I use the actual e-mail address. When it comes to using the GAL, names and punctuation must be exact (if I remember correctly).

Expand|Select|Wrap|Line Numbers
  1. Private Sub AddAppt_Click()
  2. On Error GoTo EH
  3.     Dim olApp           As Outlook.Application
  4.     Dim olAppt          As Outlook.AppointmentItem
  5.     Dim dtApptDt        As Date
  6.     Dim strSendTo       As String
  7.     Dim strSubject      As String
  8.     Dim strLocation     As String
  9.     Dim strEMailBody    As String
  10.  
  11.     dtApptDt = Date + 3
  12.     strSendTo = "Mickey@Mouse.com"
  13.     strSubject = "Show up for this meeting"
  14.     strLocation = "My Conference Room"
  15.     strEMailBody = "Y'all better show up, too!"
  16.  
  17.     'Create and Send the Appointment
  18.     Set olApp = CreateObject("Outlook.Application")
  19.     Set olAppt = olApp.CreateItem(olAppointmentItem)
  20.     With olAppt
  21.         .RequiredAttendees = strSendTo
  22.         .Subject = strSubject
  23.         .Location = strLocation
  24.         .Start = dtApptDt
  25.         .Duration = 120
  26.         .ReminderMinutesBeforeStart = 120
  27.         .ReminderSet = True
  28.         .Body = strEMailBody
  29.         .Display
  30.     End With
  31.     Set olAppt = Nothing
  32.     Set olApp = Nothing
  33.  
  34.     Exit Sub
  35. EH:
  36.     MsgBox "There was an error scheduling the Appointment!  " & _
  37.         "Please contact your Database Administrator.", vbOKOnly, "WARNING!"
  38.     Exit Sub
  39. End Sub
Let me know if this hepps....
Apr 18 '16 #5
twinnyfo
3,653 Expert Mod 2GB
Just noticed the title of this post. This is for a Task, not an Appointment. This might be different than the code provided.
Apr 18 '16 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Nicholas Then | last post by:
I have a web application that has an area for users to have suspenses (same as tasks). However this is just database controlled. Is there a way that I can create an Outlook Task with ASP.net so...
1
by: Rob McCaughey | last post by:
Hi all! I'm a VB newbie, and trying to send an Outlook Task automatically without user intervention in a VB application. When I use the following code, if I enable the send portion (see code...
0
by: William | last post by:
Hi there, Is there anybody here who ever create outlook task item from asp .net script successfully ? Actually I've created the script for creating the task, and it run successfully from the...
5
by: Imry | last post by:
Is there a way to programatically add items to the outlook task list using VB ..net?
0
by: Tim M | last post by:
Hi, Does anyone know if its possible to send an Outlook task from an ASP page running on a Windows 2000 Server on an intranet. There is also Microsoft Exchange Server on the same network which...
0
by: forbisthemighty | last post by:
A familiar behavior seen in Outlook Web Access is mini-browser windows that pop up telling the user a task is due for completion or an appointment is coming up. I'm looking for ideas on how this is...
1
by: tymperance | last post by:
I have a 2007 database that I need to add a command button that will open a new Outlook task and allow the user to input the assignment, start date, due date, etc. I've got plenty of code scripting...
2
by: Medaron | last post by:
I am trying to wite a vba code to read all my outlook task fields in Access database. So far I have following code: Sub OutlookTasks() Dim ol As Object Dim olns As Object Dim objFolder As...
0
by: Chad Dashner | last post by:
I am somewhat new at VB and I am looking to be able to create an outlook task from an access 2010 form. Is there an easy way to do this?
4
by: bkyzer | last post by:
I'd like to use a checkbox with the necessary VBA code that when checked, it would fire a MS Outlook task to the recipient based on some fields in a form that I have. My form is called All...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.