Microsoft Access - How to use if-then-else in a query

Asked By Sheri Havens on 25-Oct-13 09:52 AM
I have two tables that I need to combine into one. I'm using a query to do that. However, each table has a "Charge" field. If the field in table "Court File" is null, I want to use the field from "Jail File". Otherwise, use the "Court File".

I wrote the expression as:  Iif [Court File]![Charge]=Null,[Jail File]![Charge],[Court File]![Charge]

However, this gives me the result of all Court File - even the Null ones.

I'm sure I should probably use the Iff-Then-else. I've expirmented with that too, and keep getting an error.

Thanks for the help.
Robbe Morris replied to Sheri Havens on 25-Oct-13 11:30 AM
In SQL Server, you would use SELECT CASE ELSE END.  See if that is supported in Microsoft Access.
Sheri Havens replied to Robbe Morris on 25-Oct-13 11:33 AM
I don't think that will work. I'm writing an expression in a query. I will try it. An expression in a query doesn't require "end" So, I am not sure how to build the expression.