I have the following code on a button
The problem I am having is with an If Statement to finalize actions
I need to evaluate if all of my sPromoteResults statements are ALL<> True and if so pop up a message box and Exit the Sub. This works
However for each individual sPromoteResuts if the condition is True I want it to do something
Problem is it stops on the first True condition and never goes forward
so if I have the condition If spromoteresultsNew1 = True it should do something and
If spromoteresultsNew2 = True Then it should perform another action
It is stopping after here
How can Iensure that for every True condition it performs an action and if all 10 are <>True it gives the MsgBox and Exits Sub
Thanks
*Problem Section*******
If spromoteresultsNew1 <> True And spromoteresultsNew2 <> True And spromoteresultsNew3 <> True And sPromoteResultsNew4 <> True And spromoteresultsNew5 <> True _
And spromoterenewresults1 <> True And spromoterenewresults2 <> True And spromoterenewresults3 <> True And spromoterenewresults4 <> True And spromoterenewresults5 <> True Then
MsgBox "All criteria for new or renewal have not been met"
Exit Sub
End If
If spromoteresultsNew1 = True Then
'sPromoteResult = PromoteSubmissionToPolicyS
HS(Me.Subm
ission_ID,
PolyNum1New, Sym1New, "")
MsgBox "Promote 1 to policy"
ElseIf spromoteresultsNew2 = True Then
'sPromoteResult = PromoteSubmissionToPolicyS
HS(Me.Subm
ission_ID,
PolyNum2New, Sym2New, "")
MsgBox "Promote 2 to policy"
End If
***************** all code
'On Error GoTo Err_btnAcceptReportCrite_C
lick
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
Dim SubmissionNewRenewal As String
Dim Sym1New As String
Dim Sym2New As String
Dim Sym3New As String
Dim Sym4New As String
Dim Sym5New As String
Dim PolyNum1New As String
Dim PolyNum2New As String
Dim PolyNum3New As String
Dim PolyNum4New As String
Dim PolyNum5New As String
Dim BoundPremNew As String
Dim BoundPremNew2 As String
Dim BoundPremNew3 As String
Dim BoundPremNew4 As String
Dim BoundPremNew5 As String
Dim PolyNum1ReNew As String
Dim PolyNum2ReNew As String
Dim PolyNum3ReNew As String
Dim PolyNum4ReNew As String
Dim PolyNum5ReNew As String
Dim BoundPremReNew As String
Dim BoundPremReNew2 As String
Dim BoundPremReNew3 As String
Dim BoundPremReNew4 As String
Dim BoundPremReNew5 As String
Dim Mod1ReNew As String
Dim Mod2ReNew As String
Dim Mod3ReNew As String
Dim Mod4ReNew As String
Dim Mod5ReNew As String
Dim SubmissionStatusNew As String
Dim SubmissionStatusReNew1 As String
Dim SubmissionStatusReNew2 As String
Dim SubmissionStatusReNew3 As String
Dim SubmissionStatusReNew4 As String
Dim SubmissionStatusReNew5 As String
Dim Sym1ReNew As String
Dim Sym2ReNew As String
Dim Sym3ReNew As String
Dim Sym4ReNew As String
Dim Sym5ReNew As String
'Putting together the 3 Strings
'Orignal Full Path for the Hard Coded Submission Link Demo = "
http://cvgdev20/myFileDemo?tab=submission&submissionId=215545"
'Original Hard Coded Path for Policy Link Demo = "
http://cvgdev20/myFileDemo?tab=policy&policyNumber=1319023"
SubmissionNewRenewal = Nz([Forms]![Frm_Submission
s]![Text17
9], "")
Sym1New = Nz([Forms]![Frm_Submission
s]![Text32
7], "")
Sym2New = Nz([Forms]![Frm_Submission
s]![Text32
8], "")
Sym3New = Nz([Forms]![Frm_Submission
s]![Text32
9], "")
Sym4New = Nz([Forms]![Frm_Submission
s]![Text33
0], "")
Sym5New = Nz([Forms]![Frm_Submission
s]![Text33
1], "")
PolyNum1New = Nz([Forms]![Frm_Submission
s]![Text25
1], "")
PolyNum2New = Nz([Forms]![Frm_Submission
s]![Text25
2], "")
PolyNum3New = Nz([Forms]![Frm_Submission
s]![Text25
3], "")
PolyNum4New = Nz([Forms]![Frm_Submission
s]![Text25
4], "")
PolyNum5New = Nz([Forms]![Frm_Submission
s]![Text25
5], "")
BoundPremNew = Nz([Forms]![Frm_Submission
s]![Text24
4], 0)
BoundPremNew2 = Nz([Forms]![Frm_Submission
s]![Text24
5], 0)
BoundPremNew3 = Nz([Forms]![Frm_Submission
s]![Text24
6], 0)
BoundPremNew4 = Nz([Forms]![Frm_Submission
s]![Text24
7], 0)
BoundPremNew5 = Nz([Forms]![Frm_Submission
s]![Text24
8], 0)
PolyNum1ReNew = Nz([Forms]![Frm_Submission
s]![Text42
7], "")
PolyNum2ReNew = Nz([Forms]![Frm_Submission
s]![Text42
8], "")
PolyNum3ReNew = Nz([Forms]![Frm_Submission
s]![Text42
9], "")
PolyNum4ReNew = Nz([Forms]![Frm_Submission
s]![Text43
0], "")
PolyNum5ReNew = Nz([Forms]![Frm_Submission
s]![Text43
1], "")
SubmissionStatusNew = Nz([Forms]![Frm_Submission
s]![Text17
7], "")
Sym1ReNew = Nz([Forms]![Frm_Submission
s]![Text48
3], "")
Sym2ReNew = Nz([Forms]![Frm_Submission
s]![Text48
4], "")
Sym3ReNew = Nz([Forms]![Frm_Submission
s]![Text48
5], "")
Sym4ReNew = Nz([Forms]![Frm_Submission
s]![Text48
6], "")
Sym5ReNew = Nz([Forms]![Frm_Submission
s]![Text48
7], "")
SubmissionStatusReNew1 = Nz([Forms]![Frm_Submission
s]![Combo5
98], "")
SubmissionStatusReNew2 = Nz([Forms]![Frm_Submission
s]![Combo5
99], "")
SubmissionStatusReNew3 = Nz([Forms]![Frm_Submission
s]![Combo6
01], "")
SubmissionStatusReNew4 = Nz([Forms]![Frm_Submission
s]![Combo6
02], "")
SubmissionStatusReNew5 = Nz([Forms]![Frm_Submission
s]![Combo6
03], "")
BoundPremReNew = Nz([Forms]![Frm_Submission
s]![Text42
0], 0)
BoundPremReNew2 = Nz([Forms]![Frm_Submission
s]![Text42
1], 0)
BoundPremReNew3 = Nz([Forms]![Frm_Submission
s]![Text42
2], 0)
BoundPremReNew4 = Nz([Forms]![Frm_Submission
s]![Text42
3], 0)
BoundPremReNew5 = Nz([Forms]![Frm_Submission
s]![Text42
4], 0)
Mod1ReNew = Nz([Forms]![Frm_Submission
s]![Text1]
, "")
Mod2ReNew = Nz([Forms]![Frm_Submission
s]![Text2]
, "")
Mod3ReNew = Nz([Forms]![Frm_Submission
s]![Text3]
, "")
Mod4ReNew = Nz([Forms]![Frm_Submission
s]![Text4]
, "")
Mod5ReNew = Nz([Forms]![Frm_Submission
s]![Text44
5], "")
Dim sPromoteResult As String
Dim sPromoteResultNew1 As String
Dim sPromoteResultNew2 As String
Dim sPromoteResultNew3 As String
Dim sPromoteResultNew4 As String
Dim sPromoteResultNew5 As String
Dim sPromoteResultReNew1 As String
Dim sPromoteResultReNew2 As String
Dim sPromoteResultReNew3 As String
Dim sPromoteResultReNew4 As String
Dim sPromoteResultReNew5 As String
'RENEWAL
If Sym1ReNew <> "" And SubmissionStatusReNew1 = "Bound" And SubmissionNewRenewal = "Renewal" And BoundPremReNew > 0 Then
'sPromoteResult = PromoteSubmissionToPolicyS
HS(Me.Subm
ission_ID,
PolyNum1ReNew, Sym1ReNew, Mod1ReNew)
sPromoteResultsReNew1 = True
End If
If Sym2ReNew <> "" And SubmissionStatusReNew2 = "Bound" And SubmissionNewRenewal = "Renewal" And BoundPremReNew2 > 0 Then
'sPromoteResult = PromoteSubmissionToPolicyS
HS(Me.Subm
ission_ID,
PolyNum2ReNew, Sym2ReNew, Mod2ReNew)
sPromoteResultsReNew2 = True
End If
If Sym3ReNew <> "" And SubmissionStatusReNew3 = "Bound" And SubmissionNewRenewal = "Renewal" And BoundPremReNew3 > 0 Then
'sPromoteResult = PromoteSubmissionToPolicyS
HS(Me.Subm
ission_ID,
PolyNum3ReNew, Sym3ReNew, Mod3ReNew)
sPromoteResultsReNew3 = True
End If
If Sym4ReNew <> "" And SubmissionStatusReNew4 = "Bound" And SubmissionNewRenewal = "Renewal" And BoundPremReNew4 > 0 Then
'sPromoteResult = PromoteSubmissionToPolicyS
HS(Me.Subm
ission_ID,
PolyNum4ReNew, Sym4ReNew, Mod4ReNew)
sPromoteResultsReNew4 = True
End If
If Sym5ReNew <> "" And SubmissionStatusReNew5 = "Bound" And SubmissionNewRenewal = "Renewal" And BoundPremReNew5 > 0 Then
' sPromoteResult = PromoteSubmissionToPolicyS
HS(Me.Subm
ission_ID,
PolyNum5ReNew, Sym5ReNew, Mod5ReNew)
sPromoteResultsReNew5 = True
End If
'NEW BUSINESS
'call promote sub for new
If Sym1New <> "" And SubmissionStatusNew = "Bound" And SubmissionNewRenewal = "New" And BoundPremNew > 0 Then
' sPromoteResult = PromoteSubmissionToPolicyS
HS(Me.Subm
ission_ID,
PolyNum1New, Sym1New, "")
spromoteresultsNew1 = True
End If
If Sym2New <> "" And SubmissionStatusNew = "Bound" And SubmissionNewRenewal = "New" And BoundPremNew2 > 0 Then
'sPromoteResult = PromoteSubmissionToPolicyS
HS(Me.Subm
ission_ID,
PolyNum2New, Sym2New, "")
spromoteresultsNew2 = True
End If
If Sym3New <> "" And SubmissionStatusNew = "Bound" And SubmissionNewRenewal = "New" And BoundPremNew3 > 0 Then
'sPromoteResult = PromoteSubmissionToPolicyS
HS(Me.Subm
ission_ID,
PolyNum3New, Sym3New, "")
MsPromoteResultsNew3 = True
End If
If Sym4New <> "" And SubmissionStatusNew = "Bound" And SubmissionNewRenewal = "New" And BoundPremNew4 > 0 Then
'sPromoteResult = PromoteSubmissionToPolicyS
HS(Me.Subm
ission_ID,
PolyNum4New, Sym4New, "")
sPromoteResultsNew4 = True
End If
If Sym5New <> "" And SubmissionStatusNew = "Bound" And SubmissionNewRenewal = "New" And BoundPremNew5 > 0 Then
sPromoteResult = PromoteSubmissionToPolicyS
HS(Me.Subm
ission_ID,
PolyNum5New, Sym5New, "")
spromoteresultsNew5 = True
End If
'Exit_btnAcceptReportCrite
_Click:
If spromoteresultsNew1 <> True And spromoteresultsNew2 <> True And spromoteresultsNew3 <> True And sPromoteResultsNew4 <> True And spromoteresultsNew5 <> True _
And spromoterenewresults1 <> True And spromoterenewresults2 <> True And spromoterenewresults3 <> True And spromoterenewresults4 <> True And spromoterenewresults5 <> True Then
MsgBox "All criteria for new or renewal have not been met"
Exit Sub
End If
If spromoteresultsNew1 = True Then
'sPromoteResult = PromoteSubmissionToPolicyS
HS(Me.Subm
ission_ID,
PolyNum1New, Sym1New, "")
MsgBox "Promote 1 to policy"
ElseIf spromoteresultsNew2 = True Then
'sPromoteResult = PromoteSubmissionToPolicyS
HS(Me.Subm
ission_ID,
PolyNum2New, Sym2New, "")
MsgBox "Promote 2 to policy"
End If
'MsgBox "Promote to Policy Complete"
'Err_btnAcceptReportCrite_
Click:
'If Err.Number <> 2501 Then
'MsgBox Error$
'End If
'MsgBox Error$
'Resume Exit_btnAcceptReportCrite_
Click
Exit Sub