By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,441 Members | 998 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,441 IT Pros & Developers. It's quick & easy.

Sending a Email from Access if condition is met

P: 17
I have worked with Access for awhile but never had to send any emails out as a result of a field.

The situation I have is as follows, if a dollar amount [amount] is over $1000.00 an email generates to a specific email address. The address is static, I would like to include the name of the client[clientname] and the dollar amount in the email.

I read through a couple of threads and added the Outlook.Application library but not sure how to accomplish the rest.

Thanks for your help.
Jul 8 '08 #1
Share this Question
Share on Google+
1 Reply


P: 17
OK Follow up to the original question.
I have put together some code that is almost working.
a couple of problems, i get a invalid use of null on this code when i add the stDollaramt to the subject line. Why?
Also this code is opening the email window, how would i get the email to automatically go and not have the user see the email form?
Thanks I really appreciate your help.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Command54_Click()
  2. On Error GoTo Err_Command54_Click
  3.  
  4.     Dim stDocName As String
  5.     Dim stName As String
  6.     Dim stClientID As String
  7.     Dim stDollarAmt As String
  8.  
  9.     stName = Me.CTSNAME.Value
  10.     stClientID = Me.CTSID.Value
  11.     stDocName = "Empty_Report"
  12.     stDollarAmt = Me.ExposureAmt.Value
  13.  
  14.     DoCmd.SendObject acSendNoObject, stDocName, acFormatTXT, "Service@yahoo.com", , , stName & " Exposure Warning", "Client " & stClientID & " has a proposed exposure of " & stDollarAmt & "in Penalty", , True
  15.  
  16. Exit_Command54_Click:
  17.     Exit Sub
  18.  
  19. Err_Command54_Click:
  20.     MsgBox Err.Description
  21.     Resume Exit_Command54_Click
  22.  
  23. End Sub
  24.  
Jul 8 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.