Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2002
    Posts
    20

    Unanswered: access - outlook 2002 automated email

    Hello,

    I've cut together a short script to send automatic email messages from an order form in access (through Outlook). It is:



    Private Sub EmailThem_Click()

    DoCmd.SendObject , , acFormatRTF, "example@email.com", , , "Hello, " _
    & Me![CustomerNumber].Value, "Dear " & Me![CustomerNumber].Value _
    & "," & vbCrLf & vbCrLf & "Thanks for your order. It will be shipped out right away to " _
    & " " & Me![CustomerNumber].Value & vbCrLf _
    & " " & Me![CustomerNumber].Value & vbCrLf _
    & " " & Me![CustomerNumber].Value & vbCrLf _
    & " " & Me![CustomerNumber].Value & " " & Me![CustomerNumber].Value & " " & Me![CustomerNumber].Value _
    & " " & vbCrLf & vbCrLf _
    & "Please let me know if you have any questions." & vbCrLf & vbCrLf & "Thanks." & vbCrLf, False


    End Sub


    I would like to replace the "example@email.com" with the looked up value of customer's email address which doesn't exist on this form, but would be on the table [Customers].[Email]

    Do I need to run a dynamic lookup to obtain thsi email address or is there another function I can use to access this?

    Thanks in advance for any help!

  2. #2
    Join Date
    Aug 2002
    Location
    Syria
    Posts
    4
    Hi,
    It is a nice task.
    The best thing to do , i think, is to open a recordset and obtain the
    email address and close it. I f you are using DAO.
    Public theEmail as String ' as a public string
    dim MyRs as Recordset
    dim MySql as String
    MySql ="Select [email] from customer where ID=" & theFormID
    set MyRs =currentdb.openrecordset(MySql)
    .....
    then the Email address is MyRs!Email

    I hope this what you want

    Regards

Posting Permissions

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