Error 3021. Any help is appreciated.
On Error GoTo Error_Handler
Dim db As DAO.Database
Set db = CurrentDb()
Dim rs As Object
Set rs = CurrentDb.OpenRecordset("SELECT * FROM qryLessThan60DaysUNITPOCs")
Dim iCount As Integer
Dim rsEmail As DAO.Recordset
Dim vRecipientList As String
Dim vRecipientList2 As String
Dim vRecipientList3 As String
Dim VarTFirstName As Variant
VarTFirstName = DLookup("TFirstName", "tblRelocationTechnicians", "TechID = [Sender2]")
Dim VarTLastName As Variant
VarTLastName = DLookup("TLastName", "tblRelocationTechnicians", "TechID = [Sender2]")
Dim VarTechTitle As Variant
VarTechTitle = DLookup("TechTitle", "tblRelocationTechnicians", "TechID = [Sender2]")
Dim VarPosition As Variant
VarPosition = DLookup("Position", "tblRelocationTechnicians", "TechID = [Sender2]")
If IsNull([Sender2]) Then
MsgBox "Identify the sender of this e-mail", vbInformation, "Missing Sender"
DoCmd.GoToControl "Sender2"
Else
If rs.RecordCount > 0 Then
rs.MoveFirst
Do
If Not IsNull(rs!CCF_EMail) Then
vRecipientList = vRecipientList & rs!CCF_EMail & ";"
rs.MoveNext
Else
rs.MoveNext
End If
If Not IsNull(rs!CCF_EMail) Then
vRecipientList2 = vRecipientList2 & rs!CC_Email & ";"
rs.MoveNext
Else
rs.MoveNext
End If
If Not IsNull(rs!Chief_Email) Then
vRecipientList3 = vRecipientList3 & rs!CC_Email & ";"
rs.MoveNext
Else
rs.MoveNext
End If
Loop Until rs.EOF
DoCmd.SendObject acSendReport, "rptLessThan60DaysFromPDDUnitNotification", acFormatPDF, vRecipientList, vRecipientList2 & vRecipientList3, , "PCS Orders Cannot be Published " & vbCr & vbCr & _
"Pending", "Sir/Ma'am," & vbCr & vbCr & "BLUF: Members from your unit, on the attached listing, have not provided us with the necessary documents to prepare their PCS Orders. " & _
"Normally, members have 30 or more days to complete the process. Since this hasn't occurred, we need your assistance in encouraging these members to complete the process as soon as possible." & vbCr & _
" __________________________________________" & vbCr & "Background" & vbCr & vbCr & "It is the goal of the Air Force for individuals to have PCS orders ""in hand"" not later " & _
"than 60 days prior to their Projected Departure Date (PDD)." & vbCr & vbCr & "Everyone on this list was notified of their assignment by AFPC. They were then instructed by this office as to what actions they needed " & _
"to take (e.g., retainability) before PCS orders could be published. They were also reminded one or more times during the past month to complete the process not later than 90 days prior to their departure. " & _
"Finally, we encouraged each person if he or she needed assistance or guidance to contact their assigned relocation technician, which is listed on the attached report." & vbCr & vbCr & "vr" & vbCr & vbCr & vbCr & VarTFirstName & " " & VarTLastName & ", " & VarTechTitle & vbCr & VarPosition, True
Else
MsgBox "No one is in the 60 to 89 day window"
End If
End If
Error_Handler_Exit:
On Error Resume Next
Set rs = Nothing
Exit Sub
Error_Handler:
MsgBox "Error " & Err.Number & ": " & Err.Description & " in " & _
VBE.ActiveCodePane.CodeModule, vbOKOnly, "Error"
Resume Error_Handler_Exit
End Sub
On Error GoTo Error_Handler
Dim db As DAO.Database
Set db = CurrentDb()
Dim rs As Object
Set rs = CurrentDb.OpenRecordset("SELECT * FROM qryLessThan60DaysUNITPOCs")
Dim iCount As Integer
Dim rsEmail As DAO.Recordset
Dim vRecipientList As String
Dim vRecipientList2 As String
Dim vRecipientList3 As String
Dim VarTFirstName As Variant
VarTFirstName = DLookup("TFirstName", "tblRelocationTechnicians", "TechID = [Sender2]")
Dim VarTLastName As Variant
VarTLastName = DLookup("TLastName", "tblRelocationTechnicians", "TechID = [Sender2]")
Dim VarTechTitle As Variant
VarTechTitle = DLookup("TechTitle", "tblRelocationTechnicians", "TechID = [Sender2]")
Dim VarPosition As Variant
VarPosition = DLookup("Position", "tblRelocationTechnicians", "TechID = [Sender2]")
If IsNull([Sender2]) Then
MsgBox "Identify the sender of this e-mail", vbInformation, "Missing Sender"
DoCmd.GoToControl "Sender2"
Else
If rs.RecordCount > 0 Then
rs.MoveFirst
Do
If Not IsNull(rs!CCF_EMail) Then
vRecipientList = vRecipientList & rs!CCF_EMail & ";"
rs.MoveNext
Else
rs.MoveNext
End If
If Not IsNull(rs!CCF_EMail) Then
vRecipientList2 = vRecipientList2 & rs!CC_Email & ";"
rs.MoveNext
Else
rs.MoveNext
End If
If Not IsNull(rs!Chief_Email) Then
vRecipientList3 = vRecipientList3 & rs!CC_Email & ";"
rs.MoveNext
Else
rs.MoveNext
End If
Loop Until rs.EOF
DoCmd.SendObject acSendReport, "rptLessThan60DaysFromPDDUnitNotification", acFormatPDF, vRecipientList, vRecipientList2 & vRecipientList3, , "PCS Orders Cannot be Published " & vbCr & vbCr & _
"Pending", "Sir/Ma'am," & vbCr & vbCr & "BLUF: Members from your unit, on the attached listing, have not provided us with the necessary documents to prepare their PCS Orders. " & _
"Normally, members have 30 or more days to complete the process. Since this hasn't occurred, we need your assistance in encouraging these members to complete the process as soon as possible." & vbCr & _
" __________________________________________" & vbCr & "Background" & vbCr & vbCr & "It is the goal of the Air Force for individuals to have PCS orders ""in hand"" not later " & _
"than 60 days prior to their Projected Departure Date (PDD)." & vbCr & vbCr & "Everyone on this list was notified of their assignment by AFPC. They were then instructed by this office as to what actions they needed " & _
"to take (e.g., retainability) before PCS orders could be published. They were also reminded one or more times during the past month to complete the process not later than 90 days prior to their departure. " & _
"Finally, we encouraged each person if he or she needed assistance or guidance to contact their assigned relocation technician, which is listed on the attached report." & vbCr & vbCr & "vr" & vbCr & vbCr & vbCr & VarTFirstName & " " & VarTLastName & ", " & VarTechTitle & vbCr & VarPosition, True
Else
MsgBox "No one is in the 60 to 89 day window"
End If
End If
Error_Handler_Exit:
On Error Resume Next
Set rs = Nothing
Exit Sub
Error_Handler:
MsgBox "Error " & Err.Number & ": " & Err.Description & " in " & _
VBE.ActiveCodePane.CodeModule, vbOKOnly, "Error"
Resume Error_Handler_Exit
End Sub