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

If LastName null - use "vacant"

Status
Not open for further replies.

EllieFant

MIS
May 15, 2001
513
US
I am trying to create an expression in a query that will look at the LastName field and if it is null then put the word Vacant...if it isn't null (meaning a real person actually has that job) then I want the LastName Suffix, FirstName MiddleName to appear. I tried using the following statement but got a syntax error:

EmployeeName: iif(not isnull (LastName]), “Vacant”, [LastName] & [Suffix] & “, “ [FirstName] & “ “ & [MiddleName]

What do I need to change?

Thanks in advance for your help, Ellie
**Using Access 97 at work**
**Using Access 2000 at home**

lena.wood@starband.net
 
Try this:

EmployeeName: IIF(isnull([LastName]), “Vacant”, [LastName] & [Suffix] & “, “ [FirstName] & “ “ & [MiddleName])

Good luck! Anthony J. DeSalvo
President - ScottTech Software
"Integrating Technology with Business"
 
That worked...had to replace the " because doing the formula in word and then pasting it into access made the quotes funny and I think that was part of the problem.

Thanks for your help! Ellie
**Using Access 97 at work**
**Using Access 2000 at home**

lena.wood@starband.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top