Nested If statement

  • Thread starter Thread starter KLR
  • Start date Start date
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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top