|
Prev: Access 2007 Compact and Repair does nothing
Next: ciao
From: Stockwell43 on 2 Jul 2008 15:28 Hello, Here is the code I have behind my email button. So when a user is on a record from there they click the button and the email will pull the info from the selceted fields. Private Sub cmdSendEmail_Click() On Error GoTo EH Dim SendTo As String, SendCC As String, MySubject As String, MyMessage As String SendTo = "" SendCC = "" MySubject = "Additional Information Needed" MyMessage = vbCr & vbCr & Me.LoanNumber.Name & ": " & vbCr & Me.LoanNumber & _ vbCr & Me.AddInfo.Name & ": " & vbCr & Me.AddInfo & _ vbCr & Me.StatusUpdate.Name & ": " & vbCr & Me.StatusUpdate DoCmd.SendObject acSendNoObject, , , SendTo, SendCC, , MySubject, MyMessage, True EH: If Err.Number = 2501 Then MsgBox "This email message has not been sent. Message has been cancelled." End If End Sub The code works fine except the manager would like a few changes. 1. is there a way to make the Status Update field NOT appear if no comment was made? In other words, if that field is blank on that record they don't want the words Status Update to appear in the email. 2. How can I get this sentence: Please provide the following on the above reference loan: to appear in every email just above AddInfo? Thanks!!!
From: Stockwell43 on 2 Jul 2008 15:38 I was able to get number 2 to work so I only need to find out if number 1 is doable. Thank you! "Stockwell43" wrote: > Hello, > > Here is the code I have behind my email button. So when a user is on a > record from there they click the button and the email will pull the info from > the selceted fields. > > Private Sub cmdSendEmail_Click() > On Error GoTo EH > Dim SendTo As String, SendCC As String, MySubject As String, MyMessage > As String > SendTo = "" > SendCC = "" > MySubject = "Additional Information Needed" > MyMessage = vbCr & vbCr & Me.LoanNumber.Name & ": " & vbCr & > Me.LoanNumber & _ > vbCr & Me.AddInfo.Name & ": " & vbCr & Me.AddInfo & _ > vbCr & Me.StatusUpdate.Name & ": " & vbCr & Me.StatusUpdate > DoCmd.SendObject acSendNoObject, , , SendTo, SendCC, , MySubject, > MyMessage, True > > > EH: > If Err.Number = 2501 Then > MsgBox "This email message has not been sent. Message has been > cancelled." > End If > End Sub > > The code works fine except the manager would like a few changes. > > 1. is there a way to make the Status Update field NOT appear if no comment > was made? In other words, if that field is blank on that record they don't > want the words Status Update to appear in the email. > > 2. How can I get this sentence: > Please provide the following on the above reference loan: > to appear in every email just above AddInfo? > > Thanks!!!
From: Stockwell43 on 2 Jul 2008 15:40 I'm sorry. Is there a way to make the sentence in number 2 highlight in red everytime the email opens? "Stockwell43" wrote: > Hello, > > Here is the code I have behind my email button. So when a user is on a > record from there they click the button and the email will pull the info from > the selceted fields. > > Private Sub cmdSendEmail_Click() > On Error GoTo EH > Dim SendTo As String, SendCC As String, MySubject As String, MyMessage > As String > SendTo = "" > SendCC = "" > MySubject = "Additional Information Needed" > MyMessage = vbCr & vbCr & Me.LoanNumber.Name & ": " & vbCr & > Me.LoanNumber & _ > vbCr & Me.AddInfo.Name & ": " & vbCr & Me.AddInfo & _ > vbCr & Me.StatusUpdate.Name & ": " & vbCr & Me.StatusUpdate > DoCmd.SendObject acSendNoObject, , , SendTo, SendCC, , MySubject, > MyMessage, True > > > EH: > If Err.Number = 2501 Then > MsgBox "This email message has not been sent. Message has been > cancelled." > End If > End Sub > > The code works fine except the manager would like a few changes. > > 1. is there a way to make the Status Update field NOT appear if no comment > was made? In other words, if that field is blank on that record they don't > want the words Status Update to appear in the email. > > 2. How can I get this sentence: > Please provide the following on the above reference loan: > to appear in every email just above AddInfo? > > Thanks!!!
From: Klatuu on 2 Jul 2008 16:51 For #1. MyMessage = vbCr & vbCr & Me.LoanNumber.Name & ": " & vbCr & Me.LoanNumber & _ vbCr & Me.AddInfo.Name & ": " & vbCr & Me.AddInfo If Not IsNull(Me.StatusUpdate) Then MyMessage = My Message & vbCr & Me.StatusUpdate.Name & _ ": " & vbCr & Me.StatusUpdate End If As to your additional question, I don't know. You might try going to www.Lebans.com and see if any of his utilities will do it. -- Dave Hargis, Microsoft Access MVP "Stockwell43" wrote: > Hello, > > Here is the code I have behind my email button. So when a user is on a > record from there they click the button and the email will pull the info from > the selceted fields. > > Private Sub cmdSendEmail_Click() > On Error GoTo EH > Dim SendTo As String, SendCC As String, MySubject As String, MyMessage > As String > SendTo = "" > SendCC = "" > MySubject = "Additional Information Needed" > MyMessage = vbCr & vbCr & Me.LoanNumber.Name & ": " & vbCr & > Me.LoanNumber & _ > vbCr & Me.AddInfo.Name & ": " & vbCr & Me.AddInfo & _ > vbCr & Me.StatusUpdate.Name & ": " & vbCr & Me.StatusUpdate > DoCmd.SendObject acSendNoObject, , , SendTo, SendCC, , MySubject, > MyMessage, True > > > EH: > If Err.Number = 2501 Then > MsgBox "This email message has not been sent. Message has been > cancelled." > End If > End Sub > > The code works fine except the manager would like a few changes. > > 1. is there a way to make the Status Update field NOT appear if no comment > was made? In other words, if that field is blank on that record they don't > want the words Status Update to appear in the email. > > 2. How can I get this sentence: > Please provide the following on the above reference loan: > to appear in every email just above AddInfo? > > Thanks!!!
From: Christopher Robin on 2 Jul 2008 20:27
I believe there is a way to get your sentence highlighted in Red, but it may be more trouble than it's really worth, and I'm not certain how to do it all in VB. I have a project set up that does send an HTML formatted email out, but in order to format that email, I had to first query the DB to get the data out in XML, and then run that XML through an XSL Transformation. In the XSLT, I'm able to do many things with formatting, then the final HTML file is read into a variable and sent via VB script. "Stockwell43" wrote: > I'm sorry. > > Is there a way to make the sentence in number 2 highlight in red everytime > the email opens? > > "Stockwell43" wrote: > > > Hello, > > > > Here is the code I have behind my email button. So when a user is on a > > record from there they click the button and the email will pull the info from > > the selceted fields. > > > > Private Sub cmdSendEmail_Click() > > On Error GoTo EH > > Dim SendTo As String, SendCC As String, MySubject As String, MyMessage > > As String > > SendTo = "" > > SendCC = "" > > MySubject = "Additional Information Needed" > > MyMessage = vbCr & vbCr & Me.LoanNumber.Name & ": " & vbCr & > > Me.LoanNumber & _ > > vbCr & Me.AddInfo.Name & ": " & vbCr & Me.AddInfo & _ > > vbCr & Me.StatusUpdate.Name & ": " & vbCr & Me.StatusUpdate > > DoCmd.SendObject acSendNoObject, , , SendTo, SendCC, , MySubject, > > MyMessage, True > > > > > > EH: > > If Err.Number = 2501 Then > > MsgBox "This email message has not been sent. Message has been > > cancelled." > > End If > > End Sub > > > > The code works fine except the manager would like a few changes. > > > > 1. is there a way to make the Status Update field NOT appear if no comment > > was made? In other words, if that field is blank on that record they don't > > want the words Status Update to appear in the email. > > > > 2. How can I get this sentence: > > Please provide the following on the above reference loan: > > to appear in every email just above AddInfo? > > > > Thanks!!! |