Private Sub btnEmailQuote_Click()
' Set Up Carriage Returns
Const cR = vbCrLf
Const cRR = vbCrLf & vbCrLf
' Set Up Quote Subject
Dim strQuoteSubject As String
strQuoteSubject = "Quote # " & Me.quoteid & ": " & Me.quotedescription
' Set Up Quote Introduction
Dim strQuoteIntro As String
strQuoteIntro = "Thank you for your recent enquiry relating to the purchase of " & Me.quotedescription & ", I hope the following is of interest:" & cRR
' Set Up Quote Body
Dim strQuoteBody As String
Dim rstQuote As ADODB.Recordset
'Dim strQuoteBody As String
Set rstQuote = New ADODB.Recordset
rstQuote.Open Me.frmQuoteLine.Form.RecordSource, CurrentProject.Connection
If Not (rstQuote.EOF And rstQuote.BOF) Then
Do Until rstQuote.EOF
strQuoteBody = rstQuote("quotelinedescription") & ": " & rstQuote("quotelineqty") & vbCrLf & strQuoteBody
rstQuote.MoveNext
Loop
End If
' Dim strIn As String
' Set Up Quote Footer
Dim strQuoteFooter As String
strQuoteFooter = "Price Ex VAT: " & Format(Me.txtItemTotalExVAT, "Currency") & cRR & "Delivery Ex VAT: " & Format(Me.quotedelivery, "Currency") & cRR & "Total Ex VAT: " & Format(Me.txtTotalExVAT, "Currency") & cRR & "VAT Amount: " & Format(Me.txtVAT, "Currency") & cRR & "Grand Total: " & Format(Me.txtTotal, "Currency") & cRR
' Set Up Quote Terms 1
Dim strQuoteTerms1 As String
strQuoteTerms1 = "Quote Notes:" & cR & "===========" & cR & Me.quotenotes & cRR
' Set Up Quote Terms 2
Dim strQuoteTerms2 As String
strQuoteTerms2 = "Quote Terms:" & cR & "===========" & cR & Me.quoteterms & cRR
' Combine The Quote Elements
Dim strWholeQuote As String
strWholeQuote = strQuoteIntro & strQuoteBody & strQuoteFooter & strQuoteTerms1 & strQuoteTerms2
' Send The Quote By Email
DoCmd.SendObject acSendNoObject, subject:=strQuoteSubject, cc:="[email protected]", messagetext:=strWholeQuote, EditMessage:=True
'SET UP [email protected] in EXCHANGE
End Sub
|