IIF Query?

G

Guest

Hi -

I need to run a query for a mail merge and need to have a "addressee" field.
My table has two name fields, "first" name and "second" name.

If there is a "second" name listed, I want to use that name,
but if there is not a "second" name listed, I want to use the "first" name
listed.

This is what I wrote , but it doesn't return anything. I think I am doing
something wrong.

addressee: IIf([second_name]=Null,[first_name],IIf([second_name]=Not
Null,[second_name]," "))


Thanks,

BS
 
P

pietlinden

Hi -

I need to run a query for a mail merge and need to have a "addressee" field.
My table has two name fields, "first" name and "second" name.

If there is a "second" name listed, I want to use that name,
but if there is not a "second" name listed, I want to use the "first" name
listed.

This is what I wrote , but it doesn't return anything. I think I am doing
something wrong.

addressee: IIf([second_name]=Null,[first_name],IIf([second_name]=Not
Null,[second_name]," "))

Thanks,

BS

=iif(Not IsNull([SecondName],[SecondName],[FirstName])
 
J

John W. Vinson

If there is a "second" name listed, I want to use that name,
but if there is not a "second" name listed, I want to use the "first" name
listed.

NZ([SecondName], [FirstName])


John W. Vinson [MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top