Concatenating a textbox

D

DMainland

I would like to concatenate a text box in a report, with a twist. The text
box will always display the field 'palintiff' and the field 'defendant'. On
ocassion it may have to display 'plaintiff', 1st co-plaintiff, 2nd
co-plaintiff, defendant, 1st co-defendant, and 2nd co-defendant' or any
combination thereof. There will always be a plaintiff and defendant but not
always 1st and 2nd parties of each. I hope I made this clear. Any help in
how to concatenate the text box would be greatly appreciated.
 
R

Rick Brandt

DMainland said:
I would like to concatenate a text box in a report, with a twist. The text
box will always display the field 'palintiff' and the field 'defendant'. On
ocassion it may have to display 'plaintiff', 1st co-plaintiff, 2nd
co-plaintiff, defendant, 1st co-defendant, and 2nd co-defendant' or any
combination thereof. There will always be a plaintiff and defendant but not
always 1st and 2nd parties of each. I hope I made this clear. Any help in
how to concatenate the text box would be greatly appreciated.


= [plaintiff] & (", " + [1st co-plaintiff]) & (", " + [2nd co-plaintiff]) & (",
" + [defendant]) & (", " + [1st co-defendant]) & (", " + [2nd co-defendant])

The + will produce a Null for the entire expression within the parenthesis if
the field within is null so you should only get a ", " when the field actually
contains data.
 
F

fredg

I would like to concatenate a text box in a report, with a twist. The text
box will always display the field 'palintiff' and the field 'defendant'. On
ocassion it may have to display 'plaintiff', 1st co-plaintiff, 2nd
co-plaintiff, defendant, 1st co-defendant, and 2nd co-defendant' or any
combination thereof. There will always be a plaintiff and defendant but not
always 1st and 2nd parties of each. I hope I made this clear. Any help in
how to concatenate the text box would be greatly appreciated.

Try it this way, using an unbound text control:

= [Plaintiff] & (" "+[CoPlaintiff1]) & (" "+[CoPlaintiff2]) & " " &
[Defendent] & (" "+[CoDefentdent1]) & (" "+[CoDefendent2])
 
A

Al Campagna

DMainland,
If my suggestion doesn't work for you, please give some examples of your data, your
fields, and what you'd like to do. (what you have vs. what you want)
I'll assume...
plaintiff, 1st co-plaintiff, 2nd co-plaintiff,
are separate fields (ex. P1, P2, P3) that may or may not have values in them. Same for
Defendant (ex. D1, D2, D3)
I also assume there is always a Plaintiff.

Plaintiffs field:
= [P1] & " " & [P2] & " " & [P3]

If There is no P2 or P3, two spaces will be added to the end of P1, but that shouldn't be
a problem in a report.
If it is aproblem...
= [P1] & IIF(IsNull([P2]),""," " & [P2]) & IIF(IsNull([P3]),""," " & [P3])
 
A

Al Campagna

Fred,
I see that both you and Rick used the + in your concatenation.
That is a really an elegant solution to those pesky null/not null multi-field
concatenations!
I'll definitely remember that one...
--
hth
Al Campagna
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

fredg said:
I would like to concatenate a text box in a report, with a twist. The text
box will always display the field 'palintiff' and the field 'defendant'. On
ocassion it may have to display 'plaintiff', 1st co-plaintiff, 2nd
co-plaintiff, defendant, 1st co-defendant, and 2nd co-defendant' or any
combination thereof. There will always be a plaintiff and defendant but not
always 1st and 2nd parties of each. I hope I made this clear. Any help in
how to concatenate the text box would be greatly appreciated.

Try it this way, using an unbound text control:

= [Plaintiff] & (" "+[CoPlaintiff1]) & (" "+[CoPlaintiff2]) & " " &
[Defendent] & (" "+[CoDefentdent1]) & (" "+[CoDefendent2])
 

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