Consulting

Results 1 to 7 of 7

Thread: Solved: Sending emails from Access

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Solved: Sending emails from Access

    I'm creating a database for the contact details of the various people involved with our company.

    I'm trying to enable people to click on a contact and email that contact at the click of a button. I've set up some VBA to open a New Message in Outlook with the appropriate email address, etc.

    However I'm at something of a loss as to what to do if the person using the database doesn't use Outlook. Some people in the office use Outlook express for example. Any ideas? My code is included below.

    [vba]
    Private Sub cmdEmail_Click()

    StartOutLook

    End Sub

    Public Function StartOutLook()
    On Error GoTo Err_Handling
    Dim objOutlook As Object
    Dim objOutlookMsg As Outlook.MailItem
    Dim objOutlookRecip As Outlook.Recipient

    Set objOutlook = CreateObject("Outlook.Application")

    Set objOutlookMsg = objOutlook.CreateItem(olMailItem)

    With objOutlookMsg

    Set objOutlookRecip = .Recipients.Add(tbemail.Value)
    objOutlookRecip.Type = olTo

    .Subject = "Message from SP Projects"
    .Body = "Dear " & cboTitle & " " & tbLastName
    .Importance = olImportanceHigh
    .Display

    End With

    Set objOutlook = Nothing
    Exit Function

    Err_Handling:
    MsgBox "Error: " & Err & " " & Error
    Exit Function

    End Function
    [/vba]
    Last edited by icthus123; 06-06-2007 at 01:05 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •