Solved

how to use If condition?

Posted on 2009-04-09
11
189 Views
Last Modified: 2012-05-06
I have a loan amount with different values
if loan amount > 30,000 then  points should be 10
else if  is loan amount between 15,000 and 29,999  points should be 6
Else if loan amout between 10,000 and 14,999 points should be 3
how can i do that in access:)
can anyone help me?
0
Comment
Question by:dina78
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
  • 3
11 Comments
 
LVL 11

Expert Comment

by:bmatumbura
ID: 24105363
Use a CASE statement
0
 
LVL 23

Expert Comment

by:apresto
ID: 24105393
Have a look here, you need the IIF function by the sounds of things. MS Access doesnt support standard IF or CASE statements, unlike most other databases packages:
http://www.techonthenet.com/access/functions/advanced/iif.php 
0
 
LVL 11

Expert Comment

by:bmatumbura
ID: 24105395
Ah, sorry hadn't realized you are using Access; use an IIF statement instead:

http://www.experts-exchange.com/Programming/Languages/SQL_Syntax/Q_22840470.html
0
Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

 

Author Comment

by:dina78
ID: 24105574
just to confirm,,
i would wirte
=iff ( loan amount >30000, "10", iff(loan amount >15,000 and <29,000), "6", iff(loan amount >10,000 and <14,99), "3")
correct?
0
 
LVL 23

Expert Comment

by:apresto
ID: 24105609
I think it would be:
iff ( loan amount >30000, "10", iff(loan amount >15,000 and <29,000, "6", iff(loan amount >10,000 and <14,99, "3")))
 
0
 

Author Comment

by:dina78
ID: 24105699
=iff ( [loan Q1 incentives]![loan amount] >30000, "10", iff( [loan Q1 incentives]![loan amount] >15000 and < 29999, "6", iff( [loan Q1 incentives]![loan amount] >10000 and <14999, "3")))

but it is giving that
the expression you have entered contains invalid syntaz
help?
0
 

Author Comment

by:dina78
ID: 24105739
i used
 iff ([loan Q1 incentives]![loan amount]>30000,"10",iff(([loan Q1 incentives]![loan amount] Between 15000 And 29999),"6",iff(([loan Q1 incentives]![loan amount] Between 10000 And 14999),"3")))

but got an error of undefined function iff in expression
0
 
LVL 23

Accepted Solution

by:
apresto earned 500 total points
ID: 24105951
=iff ( [loan Q1 incentives]![loan amount] >30000, "10", iff( [loan Q1 incentives]![loan amount] >15000 and [loan Q1 incentives]![loan amount] < 29999, "6", iff( [loan Q1 incentives]![loan amount] >10000 and [loan Q1 incentives]![loan amount] <14999, "3")))

Try that, specify the field in each clause
0
 

Author Comment

by:dina78
ID: 24105980
same problem,, IFF function undefined
0
 
LVL 11

Expert Comment

by:bmatumbura
ID: 24106108
It's IIF and NOT IFF
0
 

Author Comment

by:dina78
ID: 24124644
ops!
working just fine now
thanks for the help
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SQL Syntax 24 54
SQL trigger 5 34
vb.net, web page, SQL holding the selected data in an accessible variable 7 34
StoredProcedure to JSON query faulty syntax 2 29
PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question