Dim MyDB As DAO.Database Dim rst As DAO.Recordset Dim qd As DAO.QueryDef Dim price_escNum As String Dim esc_Quote As String Dim esc_AccountNumber As String Dim esc_AccountName As String Dim SELLER_NAME As String Dim DSM_NAME As String ' outlook parameters set price_escNum = Me!PRICING_ESCALATION_ID esc_Quote = Me!QUOTE_NUMBER esc_AccountNumber = Me!ACCOUNT_NUMBER esc_AccountName = Me!ACCOUNT_NAME SELLER_NAME = Me!SELLER_NAME DSM_NAME = Me!DSM_NAME ' get the subform data now Set MyDB = CurrentDb Set qd = MyDB.QueryDefs("Query_FOR_HTML") qd.Parameters!ENTERVALUE = [Forms]![Main]![dbo_t_redbook_pricing_escalation_detail_subform]![RBP_MASTER_ID] Set rst = qd.OpenRecordset With rst Do While Not .EOF Mailbody = Mailbody & ![SKU] & " | " & ![QTY] & " | " & ![TARGET_PRICE] & vbCrLf .MoveNext Loop End With ' create the email with the subform data Dim appOutLook As Outlook.Application Dim MailOutLook As Outlook.MailItem Dim strPath As String Dim strFileName As String Set appOutLook = CreateObject("Outlook.Application") Set MailOutLook = appOutLook.CreateItem(olMailItem) With MailOutLook .BodyFormat = olFormatRichText .To = "email@example.com" '.CC = "" '.bcc = "" .Subject = "Action Required - Pricing Escalation #'" & escNum & "'" .Body = "Please review the request and advise if you support." & vbCrLf & " " & vbCrLf & _ "Request #:'" & price_escNum & "'" & vbCrLf & _ "Quote #:'" & esc_Quote & "'" & vbCrLf & _ "Account #:'" & esc_AccountNumber & "'" & vbCrLf & _ "Account Name:'" & esc_AccountName & "'" & vbCrLf & _ "Seller Name:'" & SELLER_NAME & "'" & vbCrLf & _ "DSM Name:'" & DSM_NAME & "'" & vbCrLf & _ "Please Note one or more of the Target Prices is below cost" & vbCrLf _ & " " & vbCrLf _ & Mailbody .Send End With rst.Close Set rst = Nothing MsgBox "done"
Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.
When asked, what has been your best career decision?
Deciding to stick with EE.
Being involved with EE helped me to grow personally and professionally.
Connect with Certified Experts to gain insight and support on specific technology challenges including:
We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE