Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Need a method to email a MDB file by way of MS Outlook, not Outlook Express from within MS Access

Posted on 2003-10-29
3
Medium Priority
?
694 Views
Last Modified: 2012-06-27
I received the following code from an EE member but it does not work with Outlook
Any ideas on how to modify it.

I pass to the function the parameters using a macro with the following function
   
RunCode
FunctionName      EmailFile ("Loudufresne@qwest.net",F:\Qwest\CopeXdock.mdb")


This is the code that does not work with Outlook.

Public Function EmailFile(ByVal strEmailAddress As String, ByVal strAttachmentLocation As String)
    Dim appOutlook As Object
    Dim emailItem As Object
    Dim emailAttachments As Object
    Dim emailAttach As Object
   
    Set appOutlook = CreateObject("OutlookExpress.Application")
    Set emailItem = appOutlook.CreateItem(0)
    Set emailAttachments = emailItem.Attachments
    Set emailAttach = emailAttachments.Add(strAttachmentLocation, 1)
   
    emailItem.Recipients.Add (strEmailAddress)
    emailItem.Subject = "Daily XDock Report (" & Format(Now(), "YYYYMMDD") & ")"
    emailItem.Body = "Please find attached, Access Database containing today's Xdock data , Thank You." & vbCrLf
    emailItem.Send
   
    Set emailAttach = Nothing
    Set emailAttachments = Nothing
    Set emailItem = Nothing
    Set appOutlook = Nothing
End Function


0
Comment
Question by:Lou Dufresne
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 48

Assisted Solution

by:Mikal613
Mikal613 earned 200 total points
ID: 9647169
0
 
LVL 8

Accepted Solution

by:
Benjamin_Luk earned 1400 total points
ID: 9647385
In your function code change:
Set appOutlook = CreateObject("OutlookExpress.Application")
To:
Set appOutlook = CreateObject("Outlook.Application")

And set you calling parameters correct:

("Loudufresne@qwest.net",F:\Qwest\CopeXdock.mdb")

Should be:
("Loudufresne@qwest.net","F:\Qwest\CopeXdock.mdb")

Regards

Ben
0
 
LVL 1

Author Comment

by:Lou Dufresne
ID: 9647789
Thanks you for your assistance.

Lou
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question