Concatenating First and Last Names

G

Guest

I have two fields: FirstName and LastName. I want to concatentate so the
results will be LastName, First Name. I added a column in my query and did
the following:

FullName:[LastName]&, "&[FirstName]

This works fine if all records contain a first and last name. If the record
does not, then only the comma shows. What should I write that will keep the
field blank if there is no first and last name?

Thank you for your help.
 
G

Guest

Thank you for the quick response. The result I get is the last name with a
comma and no first name is showing up.

Example: Smith,

Instead of Smith, John


MB


Ofer Cohen said:
Try

FullName: ([LastName]) & IIf([LastName] Is Null,[FirstName],(",
"+[FirstName]))

--
Good Luck
BS"D


MB said:
I have two fields: FirstName and LastName. I want to concatentate so the
results will be LastName, First Name. I added a column in my query and did
the following:

FullName:[LastName]&, "&[FirstName]

This works fine if all records contain a first and last name. If the record
does not, then only the comma shows. What should I write that will keep the
field blank if there is no first and last name?

Thank you for your help.
 
G

Guest

Mybe it's empty and not Null, try

FullName: ([LastName]) & IIf(Trim([LastName] & "") = "",[FirstName],(",
"+[FirstName]))

--
Good Luck
BS"D


MB said:
Thank you for the quick response. The result I get is the last name with a
comma and no first name is showing up.

Example: Smith,

Instead of Smith, John


MB


Ofer Cohen said:
Try

FullName: ([LastName]) & IIf([LastName] Is Null,[FirstName],(",
"+[FirstName]))

--
Good Luck
BS"D


MB said:
I have two fields: FirstName and LastName. I want to concatentate so the
results will be LastName, First Name. I added a column in my query and did
the following:

FullName:[LastName]&, "&[FirstName]

This works fine if all records contain a first and last name. If the record
does not, then only the comma shows. What should I write that will keep the
field blank if there is no first and last name?

Thank you for your help.
 
G

Guest

That did it!! Thank you!
--
MB


Ofer Cohen said:
Mybe it's empty and not Null, try

FullName: ([LastName]) & IIf(Trim([LastName] & "") = "",[FirstName],(",
"+[FirstName]))

--
Good Luck
BS"D


MB said:
Thank you for the quick response. The result I get is the last name with a
comma and no first name is showing up.

Example: Smith,

Instead of Smith, John


MB


Ofer Cohen said:
Try

FullName: ([LastName]) & IIf([LastName] Is Null,[FirstName],(",
"+[FirstName]))

--
Good Luck
BS"D


:

I have two fields: FirstName and LastName. I want to concatentate so the
results will be LastName, First Name. I added a column in my query and did
the following:

FullName:[LastName]&, "&[FirstName]

This works fine if all records contain a first and last name. If the record
does not, then only the comma shows. What should I write that will keep the
field blank if there is no first and last name?

Thank you for your help.
 

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