I've used a variation with this code with success. it had an additional function of outputting a file,attaching it, then killing the file in the temp location after sending it.
This one uses no files, but gets the 438 error. what am I missing here?
Code:
Private Sub Main_ID_AfterUpdate()
Me.Filter = "RFI_Numbers=" & Me.Main_ID
Me.FilterOn = True
End Sub
Private Sub Command50_Click()
On Error GoTo ErrorMsgs
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim strBody, strAddresses, strSubject As String
Set objOutlook = CreateObject("Outlook.Application")
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
With objOutlookMsg
.Subject = "RFI for " & ![System Name] & " - " & ![Nomenclature] & " - " & Format(Date, "dd mmm yy")
.Body = "The below information is provided for this Request For Information" & vbCrLf & vbCrLf & "In Compliance" & Chr(9) & !Compliance _
& Chr(9) & Chr(9) & "Field:" & Chr(9) & ![Field Name] & vbCrLf & vbCrLf & "System Name:" & Chr(9) & ![System Name] _
& vbCrLf & "Nomenclature:" & Chr(9) & ![Nomenclature] & vbCrLf & "Version:" & Chr(9) & !Version & vbCrLf & vbCrLf _
& "Accreditation Type:" & Chr(9) & Chr(9) & !Type_ACC & Chr(9) & !Accred & vbCrLf & "Accreditation Number:" & Chr(9) & Chr(9) & ![ACC_#] _
& vbCrLf & "Expiration Date:" & Chr(9) & Chr(9) & Format(!Expires, "dd mmmm yyyy") & vbCrLf & vbCrLf & vbCrLf & "Thank You" & vbCrLf _
& vbCrLf & "V/R" & vbCrLf & "Name" & vbCrLf & vbCrLf & "Comamnd" & vbCrLf _
& "Division" & vbCrLf & "BLDG" & vbCrLf & "City" & vbCrLf & "Tel number" _
& vbCrLf & "Email Address"
DoCmd.Close acForm, "Main Input"
.Display
End With
Set objOutlookMsg = Nothing
Set objOutlook = Nothing
Set objOutlookAttach = Nothing
Exit Sub
ErrorMsgs:
If Err.Number = "287" Then
MsgBox "You clicked No to the Outlook security warning. " & _
"Rerun the procedure and click Yes to access e-mail " & _
"addresses to send your message."
Else
MsgBox Err.Number & " " & Err.Description
End If
End Sub