PDA

View Full Version : ifs and thens or elses



Ak_girl
04-14-2006, 02:01 PM
I'm trying to use vba to populate a textbox based on a calculation of other text boxes. I'm stuck!:dunno Here's the statement I wrote:

If (Sum([PROJECT_BALANCE]) = 0) Then
Display "Fully Spent"
ElseIf (Sum([PROJECT_BALANCE]) < 0) Then
Display "OVER"
Elseif (SUM([PROJECT_BALANCE])<=(0.2*Sum([FUNDING_AMOUNT])) Then
Display 20% Notice"
End If

Please help!

OBP
04-15-2006, 04:15 AM
If "Display" is the name of your text box then you need this
If (Sum([PROJECT_BALANCE]) = 0) Then
[Display] = "Fully Spent"
ElseIf (Sum([PROJECT_BALANCE]) < 0) Then
[Display] = "OVER"
ElseIf (SUM([PROJECT_BALANCE])<=(0.2*Sum([FUNDING_AMOUNT])) Then
[Display] = "20% Notice"
End If

You could test it first by replacing the
[Display] = "Fully Sent"
with Msgbox "Fully Sent"