L
lsimonelli via AccessMonster.com
I have the following code on the 'On Click' event of a command button.
Private Sub Command34_Click()
If (Me.[Refund To/Apply To] = "Other" And IsNull(Me.[Comment B])) Then
MsgBox "You must enter explanation in box 13."
Me.[Comment B].SetFocus
Cancel = True
End If
If (Me.[Refund To/Apply To] = "Producer" And IsNull(Me.[Producer Code])) Then
MsgBox "You must enter Producer Code in box 7."
Me.[Producer Code].SetFocus
Cancel = True
End If
If (Me.[Action] = "Payment Misapplied to Policy" And IsNull(Me.[Misapplied
Policy Number])) Then
MsgBox "You must enter Mis-applied Policy Number in 10."
Cancel = True
End If
If (Me.[Action] = "Payment Misapplied to Policy & Needs to be Reinstated" And
IsNull(Me.[Misapplied Policy Number]) And IsNull(Me.[Reinstatement Date]))
Then
MsgBox "You must enter Misapplied Policy in 10 and Reinstatement Date in 11."
Cancel = True
End If
If (Me.[Action] = "Policy Needs to be Reinstated" And IsNull(Me.
[Reinstatement Date])) Then
MsgBox "You must enter Reinstatment Date in 11."
Cancel = True
End If
If (Me.[Refund To/Apply To] = "Other" And Not IsNull(Me.[Comment B])) And (Me.
[Refund To/Apply To] = "Producer" And Not IsNull(Me.[Producer Code])) And (Me.
[Action] = "Payment Misapplied to Policy" And Not IsNull(Me.[Misapplied
Policy Number])) And (Me.[Action] = "Payment Misapplied to Policy & Needs to
be Reinstated" And Not IsNull(Me.[Misapplied Policy Number]) And Not IsNull
(Me.[Reinstatement Date])) Then
DoCmd.Close
MsgBox "Your request has been submitted."
End Sub
The DoCmd.Close is not working. I'm sure it is in the last IF statement
because if I remove it, it works. Any ideas as to what is wrong with it?
Private Sub Command34_Click()
If (Me.[Refund To/Apply To] = "Other" And IsNull(Me.[Comment B])) Then
MsgBox "You must enter explanation in box 13."
Me.[Comment B].SetFocus
Cancel = True
End If
If (Me.[Refund To/Apply To] = "Producer" And IsNull(Me.[Producer Code])) Then
MsgBox "You must enter Producer Code in box 7."
Me.[Producer Code].SetFocus
Cancel = True
End If
If (Me.[Action] = "Payment Misapplied to Policy" And IsNull(Me.[Misapplied
Policy Number])) Then
MsgBox "You must enter Mis-applied Policy Number in 10."
Cancel = True
End If
If (Me.[Action] = "Payment Misapplied to Policy & Needs to be Reinstated" And
IsNull(Me.[Misapplied Policy Number]) And IsNull(Me.[Reinstatement Date]))
Then
MsgBox "You must enter Misapplied Policy in 10 and Reinstatement Date in 11."
Cancel = True
End If
If (Me.[Action] = "Policy Needs to be Reinstated" And IsNull(Me.
[Reinstatement Date])) Then
MsgBox "You must enter Reinstatment Date in 11."
Cancel = True
End If
If (Me.[Refund To/Apply To] = "Other" And Not IsNull(Me.[Comment B])) And (Me.
[Refund To/Apply To] = "Producer" And Not IsNull(Me.[Producer Code])) And (Me.
[Action] = "Payment Misapplied to Policy" And Not IsNull(Me.[Misapplied
Policy Number])) And (Me.[Action] = "Payment Misapplied to Policy & Needs to
be Reinstated" And Not IsNull(Me.[Misapplied Policy Number]) And Not IsNull
(Me.[Reinstatement Date])) Then
DoCmd.Close
MsgBox "Your request has been submitted."
End Sub
The DoCmd.Close is not working. I'm sure it is in the last IF statement
because if I remove it, it works. Any ideas as to what is wrong with it?