Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2004
    Posts
    68

    Unanswered: Email Button Problem

    I have just made a database but, i need a button that when clicked on will automatically call up Outlook Express and insert the members email address into the email ad prefribly this message for the body of the message:

    "Please return your over due video"

    Thanks

  2. #2
    Join Date
    Sep 2003
    Location
    T.O.
    Posts
    326
    You can try what's below. It's designed to work with Outlook, but if Outlook Express is your default mail application, it may work. You will need to build the logic for YourEmailAddresses.

    Private Sub Email_Click()
    On Error GoTo Email_Err
    Dim olApp As New Outlook.Application, myItem As Object, myRecipient As Recipient
    Dim olRecipients As Recipients, strTo As String
    Dim olNameSpace As Outlook.NameSpace
    ' CREATE AN OUTLOOK SESSION
    If Not olApp Is Nothing Then
    Set olNameSpace = olApp.GetNamespace("MAPI")
    If olNameSpace Is Nothing Then
    MsgBox "The Outlook Namespace could not be created"
    Set olApp = Nothing
    GoTo Email_Exit
    End If
    Else
    MsgBox "An Outlook object could not be created"
    Set olApp = Nothing
    GoTo Email_Exit
    End If

    strSubject = "Your subject goes here"

    ' CREATE THE EMAIL ITEM
    Set myItem = olApp.CreateItem(olMailItem)

    ' ADD THE INFORMATION TO THE EMAIL ITEM
    With myItem
    .Subject = strSubject
    .Body = "Please return your over due video"
    .To = YourEmailAddresses
    End With
    myItem.Display

    Email_Exit:
    Set olApp = Nothing
    Exit Sub
    Email_Err:
    MsgBox "Err: " & Err.Description & vbCrLf & "Num: " & Err.Number
    Resume Email_Exit
    End Sub
    All code ADO/ADOX unless otherwise specified.
    Mike.

Posting Permissions

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