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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I use an "If" statement in the critera of my query?

Status
Not open for further replies.

Jimenda

IS-IT--Management
Jun 13, 2001
19
0
0
US
Can I use an "If" statement in the critera of my query? If so, I am trying to return a value from a table in one column based on the condition of another column? Is this fesible? How do I do it?

Thanks
Jim
 
Use the IIF (Inline IF) function. Alternatively, always remember that you can use any function in a query and pass it fields and do any logic you want.

In the Field row, just put:
MyAliasColumnName: SomeFunction([somefield1],[somefield2],[somefieldn])

The function obviously must have the correct number & type of arguments.

The IIF goes like:
IIF(Some Expression,value if true,value if false)

--Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top