TheAceMan1,
I tried to save it to 2k ( I am in 2007) but it will not allow me to save a copy.
I used the code above and I no longer receive the error but no notes are pulling into the email. Maybe a problem with how I am trying to pull the notes in - it is towards the middle of the code
Here is the code for the email generation:
Private Sub Command103_Click()
On Error GoTo Err_cmdCommand103_Click
Dim stWhere As String '-- Criteria for DLookup (ORIGINAL LINE OF CODE)
Dim stText As String '-- E-mail text
Dim DueDate As Variant '-- Quote Due date for e-mail text
Dim PrimeNumber As Variant '-- Prime Number contract number
Dim ProjectName As Variant '-- Project Name
Dim CustomerName As Variant '-- Customer Name
Dim DuetoContracts As Variant '-- Date due to contracts
Dim ContractType As Variant '-- Contract Type
Dim DPASRating As Variant '-- DPAS Rating
Dim Lines As Variant '-- Number of lines
Dim Cust_RFQ As Variant '-- Customers RFQ#
Dim CofC As Variant '-- Certificate of conform.
Dim DD1149 As Variant '-- DD1149
Dim DD250 As Variant '-- DD250
Dim CorG As Variant '-- Commercial or Government
Dim CustNeedDate As Variant '-- Customer Product Need Date
Dim JobType As Variant '-- Type of job P or E
Dim varDueDate As String '-- Quote Due date for e-mail text
Dim stSubject As String '-- Subject line of e-mail
Dim QuoteNumber As String '-- The QuoteNumber from form
Dim QuoteNote As Variant '-- Displays the quote note
Dim QuoteNoteDate As Variant '-- Displays the quote note due date
Dim usrNotes As String '-- calls quote notes
Dim errLoop As Error
If Not IsNull(Me.Contracts) Then
'varTo = DLookup("[ContractEmail]", "tbl_Information_Contracts", "tbl_Information_Contracts.ContractName = " & Me.Contracts)
stWhere = "tbl_Information_Contracts.Contracts_ID = " & Me.Contracts
varTo = DLookup("[ContractEmail]", "tbl_Information_Contracts", stWhere)
End If
If Not IsNull(Me.Project_Quoter) Then
varTo = varTo & "; " & DLookup("[ProductionEmail]", "tbl_Information_Production", "tbl_Information_Production.ID = " & Me.Project_Quoter)
End If
'If Not IsNull(Me.Quality) Then
' varTo = varTo & "; " & DLookup("[QualityEmail]", "tbl_Information_Quality", "tbl_Information_Quality.Quality_ID = " & Me.Quality)
'End If
If Not IsNull(Me.Buyer) Then
varTo = varTo & "; " & DLookup("[BuyerEmail]", "tbl_Information_Buyers", "tbl_Information_Buyers.ID = " & Me.Buyer)
End If
If Not IsNull(Me.Engineer) Then
varTo = varTo & "; " & DLookup("[EngineerEmail]", "tbl_Information_Engineering", "tbl_Information_Engineering.ID = " & Me.Engineer)
'stWhere = "tbl_Information_Engineering.ID = " & Me.Engineer
'varTo = DLookup("[EngineerEmail]", "tbl_Information_Engineering", stWhere)
End If
stSubject = " THIS IS A TEST - PLEASE IGNORE - New Request For Quote: " & Me.Quote_Number
QuoteNumber = Me.Quote_Number
DueDate = Me.Date_Due_To_Contracts
CustomerName = Me.Customer_ID.Column(1)
ContractType = Me.Contract_Type
ProjectName = Me.Project_Name
PrimeNumber = Me.Prime_Contract_Number
DPASRating = Me.DPAS_Rating
Lines = Me.No_Line_Items
IntendedUse = Me.IntendedUse
Cust_RFQ = Me.RFQ_
CorG = Me.CorG
JobType = Me.Job_Type
CustNeedDate = Me.ProductNeedDate
DuetoContracts = Me.Date_Due_To_Contracts
Notes = usrNotes
'NoteDate = [frmQuote_Notes].Form![Date_reviewed]
If Me.DD1149 = -1 Then
DD1149 = "Yes"
Else
DD1149 = "No"
End If
If Me.CofC = -1 Then
CofC = "Yes"
Else
CofC = "No"
End If
If Me.DD250 = -1 Then
DD250 = "Yes"
Else
DD250 = "No"
End If
stText = "You have been assigned a new ticket." & Chr$(13) & _
Chr$(13) & "Quote number: " & QuoteNumber & Chr$(13) & _
Chr$(13) & "Customer Name: " & CustomerName & Chr$(13) & _
Chr$(13) & "ProjectName: " & ProjectName & Chr$(13) & _
Chr$(13) & "Date Due to Contracts: " & DuetoContracts & Chr$(13) & _
Chr$(13) & _
Chr$(13) & "Contract Type: " & ContractType & Chr$(13) & _
Chr$(13) & "Job Type: " & JobType & Chr$(13) & _
Chr$(13) & "Prime Number: " & PrimeNumber & Chr$(13) & _
Chr$(13) & "Intended Use: " & IntendedUse & Chr$(13) & _
Chr$(13) & "Number of Lines: " & Lines & Chr$(13) & _
Chr$(13) & "Customer's RFQ#: " & RFQ_ & Chr$(13) & _
Chr$(13) & "Customer's Product Need Date: " & CustNeedDate & Chr$(13) & _
Chr$(13) & _
Chr$(13) & _
Chr$(13) & "Certificate of Conformance Needed: " & CofC & Chr$(13) & _
Chr$(13) & "DD1149 Needed: " & DD1149 & Chr$(13) & _
Chr$(13) & "DD250 Needed: " & DD250 & Chr$(13) & _
Chr$(13) & "Commercial or Government: " & CorG & Chr$(13) & _
Chr$(13) & _
Chr$(13) & "Quote Notes: " & Notes & Chr$(13) & _
Chr$(13) & _
Chr$(13) & _
Chr$(13) & "This is an automated message." & _
" Please notify Contracts immediately if Bid Date cannot be met."
'Write the e-mail content for sending to assignee
DoCmd.SendObject , , acFormatTXT, varTo, , , stSubject, stText, -1
Exit Sub
Err_Execute:
' Notify user of any errors that result from
' executing the query.
If DBEngine.Errors.Count > 0 Then
For Each errLoop In DBEngine.Errors
MsgBox "Error number: " & errLoop.Number & vbCr & _
errLoop.Description
Next errLoop
End If
Resume Next
Exit_cmdCommand103_Click:
Exit Sub
Err_cmdCommand103_Click:
MsgBox Err.Description
Resume Exit_cmdCommand103_Click
End Sub