Home  Fees/Services  Microsoft Access Templates  Tutorials  Tutorial Download  Articles  Search  Contact  Privacy  Links
Create Outlook Email Using Access VB
Send Email From Access
Send Email From Access  
 




Send Outlook Email from Access

Send email to outlook from an Access form can really enhance the capability of your contact management database.  In this example we add a button automatically launch outlook using the contact's email address contained on the form.

Run MS Outlook Access Form

The first step is to locate the e-mail client, outlook.exe, on the system that uses the application. For example on the Windows XP Professional operating system using Office XP with a standard installation the outlook client can be found in C:\Program Files\Microsoft Office\Office10. You can simply hard code the location of the e-mail client directly into your code but I prefer to store it in a table, giving the user a simple interface to the table where they can enter the location themselves if necessary.

We have three examples showing how you can make your Access database interact with Outlook Email functions:

The concept behind this is to use outlook command line options to launch an e-mail message with the address from the form.

New! Download Access example of  Sending Email to Outlook
  • Simply add a button to the form and in the OnClick event add the following code. Note that the e-mail address is in a control named ContactEmail in this example.

    Private Sub btnEmail_Click()
    Dim EmailClient As Variant
    Dim stAppName As String
    Dim ClientName As String

    On Error GoTo Err_btnEmail_Click

    � Look up the base directory of the e-mail client in table EmailClient
    EmailClient = Trim(DLookup("OutLookAddress", "EmailClient"))
    If IsNull(EmailClient) Then
        ' Open a simple form asking the user to enter the base directory
        DoCmd.OpenForm "EmailClient", , , , acFormAdd
    Else
        If Not IsNull(Me!ContactEmail) And Not IsNull(EmailClient) Then
            ' if there is a \ on the end remove it
            If InStr(Len(EmailClient), EmailClient, "\") Then
                EmailClient = Left(EmailClient, Len(EmailClient) - 1)
            End If
            � add the outlook client, set the command line options, add the form address
            stAppName = EmailClient & "\outlook.exe /c ipm.note /m " & Me!ContactEmail
            � Launch Outlook
            Call Shell(stAppName, 1)
        Else
            MsgBox "The Email Client or Email Address is Null, please enter it"
        End If
    End If
    Exit_btnEmail_Click:
    Exit Sub

    Err_btnEmail_Click:
    MsgBox Err.Description
    Resume Exit_btnEmail_Click

    End Sub


    The important command line information is on the line

    stAppName = EmailClient & "\outlook.exe /c ipm.note /m " & Me!ContactEmail

     

  •  /c indicates create an object

  •  ipm.note specifies that you want an e-mail message

  •  /m says use the following e-mail address in To:

  •  Me!ContactEmail pulls the e-mail address from the form









A Blue Claw Database Design Article:

Computer Disaster Recovery Planning
 





Blue Claw Database Design Downloadable Tutorial:
Access Report Banding  





A Blue Claw Database Design Template:

Document Revision Control Application
 





Contact Information

Copyright 2000-2012 Blue Claw Database Design, LLC

VBA Tutorials:
VBA Access-Google Earth
VBA Age Calculation
VBA Change Case
VBA Email via Gmail
VBA Outlook Email
VBA Read Email Access
VBA Email Attachment
VBA Send Outlook Email
VBA Running Sum
VBA Concatenate Records
VBA Stock Quotes
VBA CreateQueryDef
VBA Find Database Path
VBA Detail-Master Update
VBA Data Validation
VBA Field Value New-Old
VBA FindFirst
VBA Access Version
VBA Global Variable Parameter
VBA Global Variables
VBA Active Labels
VBA Files List Box
VBA Mail Merge
VBA Quick Sort
VBA Recordset Filters
VBA Reference Form Field
VBA Select Case
VBA Access Transactions


Visual Basic Function Examples