Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating an "if...then...else" in Query 1

Status
Not open for further replies.

Maquis

Programmer
Joined
Jul 19, 2001
Messages
934
Location
US
Hi everyone. It's been several years now since I've used Access and I've forgotten almost everything I used to know about database design. I'm trying to create a very simple database to track some statistics and I've run into a block that I hope is simple for most of you.

I have a table (Select query actually) with 4 fields. Field 1 is just an id, Field 2 is an integer, Field 3 is an integer and Field 4 is a percent value.

I want to create a query with 4 fields. The 3 fields from the table and a 4th that = Field4 if Field2 > Field3. Otherwise the 4th value should be 0 if Field3 >= Field2.

Maq [americanflag]
<insert witty signature here>
 
iif (Field2 > Field3,Field4 ,0)
 
Thank you! It worked perfectly! It's embarassing how much I've forgotten.

Maq [americanflag]
<insert witty signature here>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top