Nested If statement

K

KLR

I need to write a nested if statement for the first time and am unsure
how to start.

My If statement is as below:-

Private Sub date_completed__charged__AfterUpdate()
If IsNull(Me.date_completed__charged_) = False Then
MsgBox "You have entered a completed charged date. Either enter a
completed no charge date or set final cost to the correct amount."
End If
End Sub

I need to look at a second control however, [finalcost]. If there has
been a date entered into completed charged AND finalcost is less than
1, that is when the message box should be displayed.

How do I do this?

KLR
 
T

Tom Lake

KLR said:
I need to write a nested if statement for the first time and am unsure
how to start.

My If statement is as below:-

Private Sub date_completed__charged__AfterUpdate()
If IsNull(Me.date_completed__charged_) = False Then
MsgBox "You have entered a completed charged date. Either enter a
completed no charge date or set final cost to the correct amount."
End If
End Sub

I need to look at a second control however, [finalcost]. If there has
been a date entered into completed charged AND finalcost is less than
1, that is when the message box should be displayed.

How do I do this?

No need to nest them if you use And. Here's the nested version:

Private Sub date_completed__charged__AfterUpdate()
If IsNull(Me.date_completed__charged_) = False Then
If Me!Finalcost < 1 Then
MsgBox "You have entered a completed charged date. Either enter
a completed no charge date or set final cost to the correct amount."
End If
End If
End Sub

Tom Lake
 
Top