x
Solved

# Access If else if syntax problem

Posted on 2009-05-08
Medium Priority
1,242 Views

I have been asked to write the following statement and am having syntax problems:

The first segement below is my instruction and the second is what I have entered in the expression builder.
``````[over60]
If debits(90)>=BAL
Then 	If (BAL-Over30)>0
then Over60=(BAL-Over30)
else Over60=0
Else over60=(Debits(90)-over30)
Endif

60To90DayDebits:Sum(IIf([Query1]![SumOf90To120DayDebits]>=[Dbo_Accounts!Balance], IIf([Dbo_Accounts!Balance]-[Query1]![SumOf30To60DayDebits]>0, [Dbo_Accounts!Balance] - [Query1]![SumOf30To60DayDebits]), 0),[Query1]![SumOf60To90DayDebits]-[Query1]![SumOf30To60DayDebits]))
``````
0
Question by:kgittinger
• 2
• 2

LVL 120

Accepted Solution

Rey Obrero (Capricorn1) earned 2000 total points
ID: 24338138
test this

60To90DayDebits:Sum(IIf([Query1]![SumOf90To120DayDebits]<[Dbo_Accounts!Balance], [Query1]![SumOf60To90DayDebits]-[Query1]![SumOf30To60DayDebits],IIf([Query1]![SumOf90To120DayDebits]>=[Dbo_Accounts!Balance] And [Dbo_Accounts!Balance]-[Query1]![SumOf30To60DayDebits]>0, [Dbo_Accounts!Balance] - [Query1]![SumOf30To60DayDebits], 0)))

or this shorter version

60To90DayDebits:Sum(IIf([Query1]![SumOf90To120DayDebits]<[Dbo_Accounts!Balance], [Query1]![SumOf60To90DayDebits]-[Query1]![SumOf30To60DayDebits],IIf([Dbo_Accounts!Balance]-[Query1]![SumOf30To60DayDebits]>0, [Dbo_Accounts!Balance] - [Query1]![SumOf30To60DayDebits], 0)))
0

Author Closing Comment

ID: 31579529
Looks great.  Thank you!
0

LVL 120

Expert Comment

ID: 24338243
did you also try did the shorter version?
0

Author Comment

ID: 24338397
Both produced the same results.  Thanks you again for all of your help.
0

## Featured Post

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.