I am trying to make sure the user selects at least one of the Reason Check Boxes before sending and email. When I leave all three Reason check boxes unchecked the email still sends, I can't figure out what I am doing wrong..... I am using the If And statements and have it set to throw up a message box if atleast one box isn't checked..
I even tried:
If (Check_Add_New_Auditor_User = False _
And Check_Add_New_Error_Code = False _
And Check_Misc_Issue = False) Then
Code:
Dim olApp As Object
Dim objMail As Object
Dim strEmailBody As String
'Test to make sure a reason box is checked
If (Check_Add_New_Auditor_User = False _
And Check_Add_New_Error_Code = False _
And Check_Misc_Issue = False) = True Then
MsgBox "Please Check a Reason for this Email"
Else
strEmailBody = Nz(txt_Support_Message, "Add Detailed Message Here")
On Error Resume Next 'Keep going if there is an error
Set olApp = GetObject(, "Outlook.Application") 'See if Outlook is open
If Err Then 'Outlook is not open
Set olApp = CreateObject("Outlook.Application") 'Create a new instance of Outlook
End If
'Create e-mail item
Set objMail = olApp.CreateItem(olMailItem)
With objMail
.To = "bconner@ameripath.com;swoodring@ameripath.com"
.Body = strEmailBody
.display
End With
If Check_Add_New_Auditor_User = -1 Then
objMail.Subject = "Add New Auditor/User"
Else
If Check_Add_New_Error_Code = -1 Then
objMail.Subject = "Add New Error Code"
Else
If Check_Misc_Issue = -1 Then
objMail.Subject = "Misc Issue"
End If
End If
End If
End If
End Sub
I even tried:
If (Check_Add_New_Auditor_User = False _
And Check_Add_New_Error_Code = False _
And Check_Misc_Issue = False) Then