Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all articles
Browse latest Browse all 13329

Error 429 when sending email from Access 2010

$
0
0
Hi all,

I have some code on a form in Access which (when a button is clicked) sends an email with the details of the new record (just entered) via Outlook.

The problem is that 1 of the machines I need this to run on comes up with an "error 429" when it tries to create the email.

I have created this form/code in Access 2007 but the users all have different versions of office.

So far I have got it working on machines with Win 8/Office 2013, Win 7/Office 2010 & Win XP/Office 2007 all using the same code.

The machine I'm having a problem with is running Office 2010 on Win 7 and comes up with the error:
Code:

ActiveX component can't create object or return reference to this object (Error 429)
The line highlighted when debugging this error is:
Code:

Set olApp = CreateObject("Outlook.Application")
All the references selected are present and the same as another machine with the same Win/Office setup (which is working fine).
One solution I found when searching online was to select the "DAO 3.6 library" unfortunately when I tried that it told me that a reference with that name was already selected (which it isn't).

Below is my code for the button press (the Str variables are strings created elsewhere in the code):
Code:

Private Sub CmdSaveSend_Click()
Dim olApp As Outlook.Application

Dim olNS As Outlook.Namespace
Dim olFolder As Outlook.MAPIFolder

Dim olMailItem As Outlook.MailItem

Set olApp = CreateObject("Outlook.Application")
Set olNS = olApp.GetNamespace("MAPI")
Set olFolder = olNS.GetDefaultFolder(olFolderInbox)
Set olMailItem = olFolder.Items.Add("IPM.Note")

StrBodyText = "Enquiry No: " & StrEnquiryNo & vbCrLf & _
    "Date: " & StrDate & " Time: " & StrTime & vbCrLf & _
    "Name: " & StrTitle & " " & StrFName & " " & StrSName & vbCrLf & _
    "Address: " & StrAddress & vbCrLf & _
    "Post Code: " & StrPostCode & vbCrLf & _
    "Email: " & StrEmail & vbCrLf & _
    "Daytime Tel: " & StrDayTel & vbCrLf & _
    "Evening Tel: " & StrEveTel & vbCrLf & _
    "Taken By: " & StrTakenBy & vbCrLf & _
    "Lead Source: " & StrLeadSource & vbCrLf & _
    "Comments: " & StrComments

With olMailItem
    .Subject = "Enquiry No: " & StrEnquiryNo
    .To = "email address omitted"
    .Body = StrBodyText
'    .Importance = olImportanceHigh
'    .FlagStatus = olFlagMarked
'    .FlagDueBy = Date + 2
'    .Display

    .Send
End With

Set olMailItem = Nothing
Set olFolder = Nothing
Set olNS = Nothing
Set olApp = Nothing
   
MsgBox ("Thank You, your lead has been saved and emailed")
End Sub

Any help would be greatly appreciated.

Thanks,
Gav

Viewing all articles
Browse latest Browse all 13329

Trending Articles