473,466 Members | 3,167 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

HELP please - Automation error

3 New Member
Hi everyone!

I am brand new to the Access world. I have downloaded files for a data base that I will use with my new job to my computer.

The data base tables and information is working great.

However, when I attempt to press the button that is suppose to open my outlook and import the emails - so that I can email the selelcted emails formt eh data base - I get a Run-time Error. I am so unfamiliar with programming - and I need some help!

Here is the error:
2147024770 (8007007e)
Automation error
The specified module could not be found.

I click on 'debug' and the following is what I see: (I made bold the line that is hilted yellow on my screen)

Expand|Select|Wrap|Line Numbers
  1. Public Sub CreateEmail(AllRecipients As Boolean, Optional EMail As String = "")
  2.    Dim rs As DAO.Recordset
  3.    Dim appOutLook 'As Outlook.Application
  4.    Dim objMAPINameSpace 'As NameSpace
  5.    Dim objMailItem 'As MailItem
  6.    Dim objRecipient 'As Recipient
  7.    Dim strSubject As String
  8.  
  9. Set appOutLook = CreateObject("Outlook.Application")
  10.  
  11.    If appOutLook = "Outlook" Then
  12.       strSubject = InputBox("Enter the subject of the e-mail", "Subject")
  13.       Set objMAPINameSpace = appOutLook.GetNamespace("MAPI")
  14.       objMAPINameSpace.Logon "profile", "password"
  15.       Set objMailItem = appOutLook.CreateItem(0)   'olMailItem=0
  16.       If AllRecipients Then
  17.          Set rs = CurrentDb.OpenRecordset("SearchResults", dbOpenForwardOnly)
  18.       Else
  19.          If EMail = "" Then
  20.             Set rs = CurrentDb.OpenRecordset("SELECT * FROM SearchResults WHERE SendTo = True", dbOpenForwardOnly)
  21.          Else
  22.             Set rs = CurrentDb.OpenRecordset("SELECT * FROM SearchResults WHERE False", dbOpenForwardOnly)
  23.          End If
  24.       End If
  25.       While Not rs.EOF
  26.          Set objRecipient = objMailItem.Recipients.Add(rs!Email1)
  27.          objRecipient.Type = 3   'olBCC=3
  28.          Set objRecipient = Nothing
  29.          rs.MoveNext
  30.       Wend
  31.       If EMail <> "" Then
  32.          Set objRecipient = objMailItem.Recipients.Add(EMail)
  33.          objRecipient.Type = 3   'olBCC=3
  34.          Set objRecipient = Nothing
  35.       End If
  36.       rs.Close
  37.       Set rs = Nothing
  38.       objMailItem.Subject = strSubject
  39.       objMailItem.Body = "Message body goes here"
  40.       objMailItem.Save
  41.       objMAPINameSpace.Logoff
  42.       Set objMAPINameSpace = Nothing
  43.       Set appOutLook = Nothing
  44.  
  45. '      MsgBox "Your e-mail message has now been prepared and saved in your draft messages." & vbCrLf & _
  46. '             "Please verify that the message is correct before sending it.", vbInformation, "Message Created"
  47.    Else
  48.       MsgBox "Error opening Outlook." & vbCrLf & _
  49.              "Please try again before verifying with Daniel.", vbInformation, "Outlook Error"
  50.    End If
  51. End Sub
Sep 25 '07 #1
5 3419
Scott Price
1,384 Recognized Expert Top Contributor
First of all, what version of Access and Outlook are you running?

Regards,
Scott
Sep 25 '07 #2
smdupont
3 New Member
I am using access 2003 and outlook 2003. (sorry - should have thought to say that in the original post)
Sep 25 '07 #3
Scott Price
1,384 Recognized Expert Top Contributor
I am using access 2003 and outlook 2003. (sorry - should have thought to say that in the original post)
OK, there are two things that come to mind... The most satisfactory resolution will come from the first, less satisfactory from the second.

When you open the database, press Alt+F11. This will bring up the VBA code window. Go to the Tools menu and click on References (first item on the list). Scroll the menu until you find Microsoft Office 12.0 Object Library and click the check box. (Note there will also be a Microsoft Access 11.0 Object Library, that is not the same as the Office library).

Try your email again.

Post back here if this doesn't work and we'll try the second.

Regards,
Scott
Sep 26 '07 #4
smdupont
3 New Member
I found the item in the list - and checked the box.

(it was version 11 instead of 12).

Then I tried the email button again - and I still get the same errror message.

So we will have to try option #2

Sherri
Sep 26 '07 #5
Scott Price
1,384 Recognized Expert Top Contributor
I found the item in the list - and checked the box.

(it was version 11 instead of 12).

Then I tried the email button again - and I still get the same errror message.

So we will have to try option #2

Sherri
For Office 2003 it should be version 12, check again to make sure that you have the Office and not Access object library. Also, have you installed all the MS Office updates? As an added suggestion, go to their website and see what updates they suggest (not just Windows updates, but Office updates as well.)

Regards,
Scott
Sep 26 '07 #6

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

Similar topics

25
by: Neil Ginsberg | last post by:
I have a strange situation with my Access 2000 database. I have code in the database which has worked fine for years, and now all of a sudden doesn't work fine on one or two of my client's...
1
by: Jimmer | last post by:
I've got what should be an easy automation problem, but the solution simply isn't coming to me. I've got several public variables set up for automation as follows: Public gappExcel As...
2
by: DD | last post by:
I have developed a a nice little software package(Packaged with Wise and SageKey) My product works great in a clean enviroment on Win98 and Win2k and XP As soon as i introduce Office 2000 Pro onto...
4
by: gs | last post by:
I have searched Google, MSDN,... for a week. I am still unable to make available functions in my csharp dll as native windows functions for some legacy non dotnet application I just want to...
2
by: Andrew Cranwell | last post by:
Hi, Please redirect me if I am in the wrong group for this question... this is my first post to this group, so I hope it is clear! I am working on an automation project in VB.NET and have to...
1
by: electrixnow | last post by:
I need some help on automation for office. I found some code I want to use, it looks like this: Variant wordTables = wordActiveDocument.OlePropertyGet( "Tables" ); long table_count =...
1
by: Bruce | last post by:
Hello, I know this must be something simple I'm overlooking but I can't get err.raise inside a class to return anything but 440 - automation error. For example, if I create the following test...
3
by: jambonjamasb | last post by:
Hi I have two tables: email_tbl Data_table Data table is is used to create a Form Data_form
1
by: dittytwo | last post by:
hi there i have been tasked with automating a simple create email task using microsoft outlook. the code below works create unfortunately it works only at a system level i.e. the user does not see...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
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
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.