Wrox Programmer Forums
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 31st, 2008, 09:19 PM
Registered User
 
Join Date: Jul 2008
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
        .Display
        '.Send
    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?

Thanks,

Maxgrunt
 
Old July 31st, 2008, 09:21 PM
Registered User
 
Join Date: Jul 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.

Maxgrunt





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





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.