Access labels

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to print labels. I have pulled over the fields I want, but I don't
know how to add a & between first names for marries couples, and have the &
dissapear for a single person.

Help!
 
Assuming you've got two FirstName fields, try something like:

=[FirstName1] & (" & " + [FirstName2])

Using + to concatenate text fields propagates Nulls: if [FirstName2] is
Null, then " & " + [FirstName2] will be Null.
 
This does not work. It puts & before the First Name (when there is just one
name)
[FirstName(M)] [FirstName(F)] [LastName]
these are my three fields I want to combine
However, I don't always have a Male and Female.
any more suggestions?

Douglas J. Steele said:
Assuming you've got two FirstName fields, try something like:

=[FirstName1] & (" & " + [FirstName2])

Using + to concatenate text fields propagates Nulls: if [FirstName2] is
Null, then " & " + [FirstName2] will be Null.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


norkirk said:
I want to print labels. I have pulled over the fields I want, but I don't
know how to add a & between first names for marries couples, and have the
&
dissapear for a single person.

Help!
 
How about something like this:
[FirstName(M)] & IIF(Nz([FirstName(M)]) and Nz([FirstName(F)]), " & ", "") &
[FirstName(F)]

--
Zac Woodall | Program Manager | Microsoft Access

norkirk said:
This does not work. It puts & before the First Name (when there is just
one
name)
[FirstName(M)] [FirstName(F)] [LastName]
these are my three fields I want to combine
However, I don't always have a Male and Female.
any more suggestions?

Douglas J. Steele said:
Assuming you've got two FirstName fields, try something like:

=[FirstName1] & (" & " + [FirstName2])

Using + to concatenate text fields propagates Nulls: if [FirstName2] is
Null, then " & " + [FirstName2] will be Null.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


norkirk said:
I want to print labels. I have pulled over the fields I want, but I
don't
know how to add a & between first names for marries couples, and have
the
&
dissapear for a single person.

Help!
 
Yeah, since you don't know whether it's FirstName(M) or FirstName(F) that's
missing, it is more of an issue:

=[FirstName(M)] & IIf(IsNull([FirstName(M)] + [FirstName(F)]), "", " & ") &
[FirstName(F)]

BTW, personally I'd suggest renaming your fields: having special characters
like parentheses in your field names can potentially lead to problems.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


norkirk said:
This does not work. It puts & before the First Name (when there is just
one
name)
[FirstName(M)] [FirstName(F)] [LastName]
these are my three fields I want to combine
However, I don't always have a Male and Female.
any more suggestions?

Douglas J. Steele said:
Assuming you've got two FirstName fields, try something like:

=[FirstName1] & (" & " + [FirstName2])

Using + to concatenate text fields propagates Nulls: if [FirstName2] is
Null, then " & " + [FirstName2] will be Null.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


norkirk said:
I want to print labels. I have pulled over the fields I want, but I
don't
know how to add a & between first names for marries couples, and have
the
&
dissapear for a single person.

Help!
 
I get Type Mismatch on that,. Zac. I didn't think you could And together
Text.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Zac Woodall said:
How about something like this:
[FirstName(M)] & IIF(Nz([FirstName(M)]) and Nz([FirstName(F)]), " & ", "")
& [FirstName(F)]

--
Zac Woodall | Program Manager | Microsoft Access

norkirk said:
This does not work. It puts & before the First Name (when there is just
one
name)
[FirstName(M)] [FirstName(F)] [LastName]
these are my three fields I want to combine
However, I don't always have a Male and Female.
any more suggestions?

Douglas J. Steele said:
Assuming you've got two FirstName fields, try something like:

=[FirstName1] & (" & " + [FirstName2])

Using + to concatenate text fields propagates Nulls: if [FirstName2] is
Null, then " & " + [FirstName2] will be Null.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


I want to print labels. I have pulled over the fields I want, but I
don't
know how to add a & between first names for marries couples, and have
the
&
dissapear for a single person.

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

Back
Top