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

isNull Help!!!

Status
Not open for further replies.

DrSql

Programmer
Jul 16, 2000
615
US
I am trying to concatenate Title, FirtsName, MI & LastName in Access. I have created and expressions but small concern.
There are few people dont have a MI so using the first syntax, it get ommited for null MI's
Syntax 1:
select FullName: [Title]+' '+[FirstName]+' '+[MI]+'. '+[LastName] from EmpTable
or
and error for this syntax.
Syntax 2:
select FullName: [Title]+' '+[FirstName]+' '+IsNull([MI])+'. '+[LastName] from EmpTable

Any help would be appreciated.
Thanks

Dr.Sql
Good Luck.
 
You should be using ampersands [red]&[/red] for concatenating strings. Try:

FullName: [Title] & ' ' & [FirstName] & ' ' & IIf(IsNull([MI]),'',[MI] & '. ') & [LastName]

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Try
Code:
Select NZ([Title]) & ' ' & [FirstName] & ' ' & IIF(IsNull([MI]), "", [MI] & '. ') & [LastName] As FullName
From EmpTable
IsNull returns TRUE or FALSE ... not the value of the variable.
 
Another way:
Code:
FullName: Title & ' ' & FirstName & ' ' & Nz(MI+'. ','') & LastName

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I can name that tune in...[ponder]
Code:
FullName: Title & ' ' & FirstName & ' ' & [MI]+ '. ' & LastName


Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Thanks all for your quick reponses.

Dr.Sql
Good Luck.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top