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

IF THEN ELSE query

Status
Not open for further replies.

shannonlp

Technical User
Joined
Feb 9, 2006
Messages
163
Location
US
Hi,

I’m trying to write an IF ELSE THEN query in Access. I’m trying to write the query so that

if table1.column1 = table2.column2, then table2.column2
else
table1.column2

Here is my syntax I’ve used in the query builder:

IIf([Customer_template_09252008]![Country Code]=[Country codes]![Country Name],[Country codes]![Country Code],[Customer_template_09252008]![Country Code])

I need all rows returned in table1 (2537)
What this query is doing is returning only the rows that match (2382)
I need it to handle the missing 155 rows that do not match. For those 155, I need it to display the table1.column2 value.

Any help would be greatly appreciated!

Shannon
 
sounds like you need a LEFT OUTER JOIN

can you show the rest of the query?

r937.com | rudy.ca
 
Thanks - I resolved it using an outer join.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top