Results 1 to 5 of 5
  1. #1
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Morecambe England, Lancashire, England
    Posts
    105
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Sending Emails from Access (Access 2000)

    I have a field in on my form holding the Email address for a person and naively thought that all I would have to do to send an email to that person is to change the data type in the table to Hyperlink and a click in the field would open Outlook Express. Well I now know that all it does is link to their web site!

    I have searched the previous threads, but cannot find what I would have thought is a relatively straightforward action.

    So could I ask how on earth do you do it!

    I have another field that is the telephone number and all I did was use the command button wizard to create a button to open the telephone dialer and that works very well indeed and I had assumed that this would have been just as simple

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Sending Emails from Access (Access 2000)

    If you want to use a hyperlink field to send e-mails, the e-mail address should be prefixed with "mailto:", e.g. mailto:billg@microsoft.com. You can also use a standard text field, and put code like this in the on click event for a command button:

    Application.FollowHyperlink "mailto:" & Me.EmailField

    or

    DoCmd.SendObject To:=Me.EmailField

  3. #3
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Vancouver, Br. Columbia, Canada
    Posts
    632
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Sending Emails from Access (Access 2000)

    Here is a code snippet for sending email (expects strings named sText, sSubject, and sMessage. It would typically go into the Click event of a command button on your form.

    DoCmd.SendObject objecttype:=acSendNoObject, _
    TO:=sText, Subject:=sSubject, messagetext:=sMessage



    Here is code that I use for AutoDial - expects a textbox named txtPhoneToCall to exist on the form

    Private Sub cmdDial_Click()
    On Error GoTo Err_cmdDial_Click

    Const ERR_OBJNOTEXIST = 2467
    Const ERR_OBJNOTSET = 91
    Application.Run "utility.wlib_AutoDial", Me![txtPhoneToCall]
    Exit_cmdDial_Click:
    Exit Sub
    Err_cmdDial_Click:
    If (Err = ERR_OBJNOTEXIST) Or (Err = ERR_OBJNOTSET) Then
    Resume Next
    End If
    MsgBox Err.Description
    Resume Exit_cmdDial_Click
    End Sub
    --------------------------------------------------
    Jack MacDonald
    Vancouver, Canada

  4. #4
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Morecambe England, Lancashire, England
    Posts
    105
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Sending Emails from Access (Access 2000)

    Hi Hans

    Thanks for that code it works perfectly.

    I used

    DoCmd.SendObject To:=Me.Email

    and it worked straight away

    Thanks again

    Michael

  5. #5
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Morecambe England, Lancashire, England
    Posts
    105
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Sending Emails from Access (Access 2000)

    Hi - thanks for the code

    I use:-

    Private Sub CmdTelephone_Click()
    Dim stDialStr As String
    stDialStr = [Telephone]
    Application.Run "utility.wlib_AutoDial", stDialStr
    Exit_CmdTelephone_Click:
    End Sub

    But use use more error checking

    Thanks for the tip

    Michael

Posting Permissions

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