Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Access 2007 VBA Programmer's Reference ISBN: 978-0-470-04703-3
This is the forum to discuss the Wrox book Access 2007 VBA Programmer's Reference by Teresa Hennig, Rob Cooper, Geoffrey L. Griffith, Armen Stein; ISBN: 9780470047033
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Access 2007 VBA Programmer's Reference ISBN: 978-0-470-04703-3 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 31st, 2008, 09:19 PM
Registered User
Join Date: Jul 2008
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Sending email in access 2007

No matter what I try, I can't get this to work. I have used the sample application in Chapter 16. I have opened the VBA editor, Selected Tool / References and made sure the Check is on for Microsoft Outlook 12.0 Object Library.... But every time I run the code under the button I get the Error Message Run-time '429': ActiveX component can't create object..... When I select debug the offending line of code is:

Set olApp = CreateObject("Outlook.Application")

Here is the entire sub:

Private Sub cmdAlert_Click()

    Dim strBodyText As String

    'Reference the Outlook Application
    Dim olApp As Outlook.Application

    'The NameSpace object allows you to reference folders
    Dim olNS As Outlook.NameSpace
    Dim olFolder As Outlook.MAPIFolder

    'Create a reference to the email item you will use to send your email
    Dim olMailItem As Outlook.MailItem

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

    'Create the body of the message from the data in the form
    strBodyText = "Material for Order #" & Me.OrderNumber & vbCrLf & _
        "Order Due Date: " & Me.OrderDate & vbCrLf & _
        "Action: Inform customer it will be late"

    'Update the new mail object with your data
    With olMailItem
        .Subject = "Material Delay for Order #" & Me.OrderNumber
        .To = "OrderEntry@AbraxisCorporation.com"
        .Body = strBodyText
        .Importance = olImportanceHigh
        .FlagStatus = olFlagMarked
        .FlagDueBy = Date + 2
    End With

    'Release all of your object variables
    Set olMailItem = Nothing
    Set olFolder = Nothing
    Set olNS = Nothing
    Set olApp = Nothing

End Sub

I have been all over Microsoft to solve this, I have read every manual I have, I even bought this book to solve it and It just won't work.... Any suggestions?


Reply With Quote
  #2 (permalink)  
Old July 31st, 2008, 09:21 PM
Registered User
Join Date: Jul 2008
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts

Oh, I should mention that this is supposed to send the mail via Outlook 2007. I have Outlook 2007 on my system and use it all the time so I know it is OK.

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Access 2007 JohnBoy VB.NET 2002/2003 Basics 1 March 16th, 2008 09:33 PM
Need Help in sending email khalidj06 Forum and Wrox.com Feedback 6 April 14th, 2006 08:16 AM
email sending msrnivas .NET Web Services 6 June 26th, 2004 06:59 AM
Sending Email soccers_guy10 Pro VB 6 3 February 11th, 2004 10:41 AM

All times are GMT -4. The time now is 09:13 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.