Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

automated email through outlook

Status
Not open for further replies.

bricklebrit

Technical User
Mar 2, 2002
26
US
Hello,

I was interested in programming a button in an order form sends an automated email to the customer through Outlook. The customer's email address are already stored in a linked table. Are there any pre-programmed basic scripts that could send a message like:

"
Hello [firstName],

Thanks your [check/payment] arrived safely.

"

Thanks in advance for any advice or assistance! :)
 
The below code is some I have been using in a help desk environment to notify the user that theie help desk request has been received.....It uses the DoCmd.SendObject command. The help file for SendObject has all the fields explained.

If you need any help, please let me know.

'****Start Code***********
DoCmd.SendObject , , acFormatRTF, Me![txtEmail].Value, , , "Work Order #" _
& Me![txtWO#].Value & " - " & Me![txtSummary].Value, "Dear " & Me![cboUser].Value _
& "," & vbCrLf & vbCrLf & "We have received your work order request. " _
& Me![cboResponsible].Value & " has been assigned to handle your issue. It has been " _
& "logged into our tracking system as a Severity " & Me![txtPriority].Value & " and " _
& "should be completed no later than " & Me![txtDueDate].Value & ". If you have any " _
& "questions, please contact the Help Desk by e-mail and include the work order number " _
& "in the subject line." & vbCrLf & vbCrLf & "Thank You" & vbCrLf & "Help Desk" & vbCrLf _
& "x1357", False
It's not important that someone else can do in one step what it took you ten to do...the important thing is that you found a solution. [spin]

Robert L. Johnson III, A+, Network+, MCP
Access Developer/Programmer
 
Hi Robert,

Thanks for your prompt response and assistance. I'm using Access and Outlook 2002 -- I modified the code and entered my database values, but I'm getting an error:

Run-time error '438'
Object doesn't support this property or method

Am I missing any of the code to have it tell Outlook that it is sending a new message? My code so far is:

Private Sub PaidEmailButton_Click()

DoCmd.SendObject , , acFormatRTF, [Customers]!.Value, , , "Thanks, " _
& Me![CustomerNumber].Value & " - ", "Dear " & [Customers]![CustomerName].Value _
& "," & vbCrLf & vbCrLf & "Thanks the payment arrived for your order on" _
& Me![OrderDate].Value _
& ". If you have any questions, please don't hesitate to email me. " _
& vbCrLf & vbCrLf & "Thank You" & vbCrLf & vbCrLf _
& ".", False

End Sub
 
Well, I am unsure....

First, change you code to:

DoCmd.SendObject , , acFormatRTF, [Customers]!.Value, , , "Thanks, " _
& Me![CustomerNumber].Value & " - ", "Dear " & [Customers]![CustomerName].Value _
& "," & vbCrLf & vbCrLf & "Thanks the payment arrived for your order on" _
& Me![OrderDate].Value _
& ". If you have any questions, please don't hesitate to email me. " _
& vbCrLf & vbCrLf & "Thank You.", False

You'll notice I took off the last two vbCrLf's....you would have had you period for the end of the sentence on the next line...:)

As for needing something else, I have successfully used this code for both Access 97 and Access 2000. I have no experience with Access 2002. My recommendation would be to try defining the application better. I'll try to explain.

First open you code and click Tools -> References in the menu bar at the top. Look for a checked reference to Outlook. For Access 2000/Outlook 2000 it is Microsoft Outlook 9.0 Object Library. Find one similar for your Outlook and make sure it is checked. The try the DoCmd.SendObject command again.

If that doesn't work, you will have to try and see if you can define the Outlook Application. I haven't used this before, and don't want to steer you down the wrong road.... It's not important that someone else can do in one step what it took you ten to do...the important thing is that you found a solution. [spin]

Robert L. Johnson III, A+, Network+, MCP
Access Developer/Programmer
 
Hi Robert,

Thanks for the assistance, I fixed the code to what you sent me and I went into the references and checked "Microsfot Outlook 10 Object Library" and "Outlook view control."

Unfortunately I'm still getting the same error:

Run-time error '438'
Object doesn't support this property or method

If you have any other thoughts, please let me know and thanks for the assistance!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top