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

Adding Font Attributes to Concatenated Fields 5

Status
Not open for further replies.

jdegeorge

Programmer
Mar 19, 2002
1,313
US
Hi:

I have a control on a report that's made up of several table fields:

=IIf(IsNull([Resolution]),"Description: " & [Description] & Chr(13) & Chr(10) & "Assessment: " & [Assessment],"Description: " & [Description] & Chr(13) & Chr(10) & "Assessment: " & [Assessment] & Chr(13) & Chr(10) & "Resolution: " & [Resolution])

It does what I need it to do, but I'd really love to make the words "Description", "Assessment" and "Resolution" bold if I could. Is there a way to do that?

Jim DeGeorge [wavey]
 
Maybe I'm missing something, but why not use 4 text boxes (1 label and 3 text boxes actually) instead of the one? Then you could have bold what you want and line it up how you want as well. Let me know what I missed...

Kevin
 
Only DESCRIPTION and ASSESSMENT are always populated. RESOLUTION isn't, hence the need for the IIF(). If I stack 3 text boxes on top of each other, with RESOULTION being the 3rd/bottom one, I'd always have an extra blank line in the report if RESOLUTION was blank, hence the need for the concatenation.

Is there no way to partially bold contents of a text box?

Jim DeGeorge [wavey]
 
Oh, gotcha...missed the 3rd row in the statement. I don't know of a way to partially bold a text box...I think I would still split things up...just have your titles in one text box (with the same iif) and then have the results in another right next to it (using the iif again)...then you could bold the titles box. I think that would line up ok...not sure though.

Kevin
 
Kevin

Thanks for really putting the thinking cap on for this one. If I could guarantee the size of these fields, your separate text box idea for the titles would work.

Thanks any way!

Jim DeGeorge [wavey]
 
You couldn't have something like this?

=IIf(IsNull([Resolution]),"Description: " & Chr(13) & Chr(10) & "Assessment: ","Description: " & Chr(13) & Chr(10) & "Assessment: " & Chr(13) & Chr(10) & "Resolution: ")

That would be your title text box, then next to that have:

=IIf(IsNull([Resolution]), [Description] & Chr(13) & Chr(10) & [Assessment], [Description] & Chr(13) & Chr(10) & [Assessment] & Chr(13) & Chr(10) & [Resolution])

You'd just have to make sure the result text box is big enough...but that's the same with your original box I think. Just throwing it out there.

Kevin
 
Kevin

Right now I've got all the column titles across the top of the report. For this column, the column heading is "Description / Assessment / Resolution". It's a really tight report and is already 8.5" x 14 landscape.

So, the current contatenated text box puts out information like this:

[tt]Description: This is the description of the
issue at hand.
Assessment: This is the assessment of the
issue at hand.
Resolution: This is the resolution.[/tt]

Your suggestion involves basically 2 boxes side-by-side taking up the width of the previous single box. Although it would work, would make it look like this:

[tt]Description: This is the description of the
issue at hand.
Assessment: This is the assessment of the
issue at hand.
Resolution: This is the resolution.[/tt]

I could force that each title be 2 lines, but if the value of those fields is only 1 line, then I'll have this:

[tt]Description: This is the description.
This is the assessment of the
Assessment: issue at hand.
This is the resolution.
Resolution:[/tt]

That wouldn't work. I still like your idea and may use it in another situation. Thanks!

Jim DeGeorge [wavey]
 
Ahhh, I see what you're saying...I was thinking you had plenty of horizontal room (for some reason you putting in the carriage return made me think that way), didn't see what was going on. Thanks for the explanation, sorry I couldn't help.

Kevin
 
Thanks for trying so hard. Have a star for the valiant effort!

Jim DeGeorge [wavey]
 
I would create 3 pairs of text boxes (no labels). Control sources of the "label" text boxes would be:
="Description: "+[Description]
="Assessment: "+[Assessment]
="Resolution: "+[Resolution]
Set these all to can shrink (not can grow) and make sure their width only displays what you want to see. Make them bold.

If the Resolution field is null then the bottom text box will be null and will shrink to nothing.

Duane
MS Access MVP
 
Duane

If I have the 3 boxes as you suggest and make them bold, isn't that the same as making the 1 concatenated box bold? The result would be that everything is bold when only "Description", "Assessment" and "Resolution" need to be bold, but not the contents of the fields.

This is a puzzler.

I know you can change the font attributes for pieces of the same text box in Excel. I guess it can't be done in Access.

Thanks any way! A star for your valiant effort as well!

Jim DeGeorge [wavey]
 
I couldn't get this to work...am I missing something? It didn't work with the "+" (got "error") and it won't work with the "&" since that field would never be empty (the text will show up). Plus I think it still runs into the problem mentioned above...the text will only wrap in its own text box, not under the "label" text box like he wants.
 
The three text boxes are only to display the labels. Three additional text boxes display the field values. Make sure the three "label" text boxes have a name that is not the name of a field. If your text box is named "Description" and your control source is ="" + [Description], this will always fail.

You should end up with two columns of three text boxes. The "label" text boxes that I described on the left and the actual field values on the right.

If you want the text to wrap then you will still need 6 text boxes. Move the text boxes from the right column to line up their left sides with the "label" text boxes. Change the control sources of the boxes from the right from:
[Description]
to
=" " + [Description]
Make sure the background is transparent so the "Label" text boxes will show through. Also, make sure you have enough spaces so your text doesn't overlap.

Again, your text box names can't be the same as a field name.

Duane
MS Access MVP
 
Duane

You described 3 boxes:

[tt]="Description: "+[Description]
="Assessment: "+[Assessment]
="Resolution: "+[Resolution][/tt]

These appear to include both the title and the field in each.

What should the other 3 boxes look like? And, what if the fields wrap? How do the title align properly with the fields?

Jim DeGeorge [wavey]
 
=" "+[Description]
=" "+[Assessment]
=" "+[Resolution]
The spaces above need to be wide enough to show the title text boxes.
To Simplify:
Create a text box:
Name: txtDescTitle
Control Source: "Description: " + [Description]
Left: 0.5"
Top: 0.25
Width: wide enough to only display "Description:"
Can Grow: No
Can Shrink: Yes
Back Style: Transparent

Create another text box:
Name: txtDesc
Control Source: " " + [Description]
Left: 0.5" (same as txtDescTitle)
Top: 0.25" (same as txtDescTitle)
Width: wide as you want it
Can Grow: Yes
Can Shrink: Yes
Back Style: Transparent

Run it and adjust so the text appears properly.

Duane
MS Access MVP
 
Duane

I tried it and it works! The 2nd box overlays the first, and since they're both transparent, the bold title shows through where it's supposed to be, and the titles line up with the fields!

The only small problem is that sometimes there's a little extra space between the fields. It tried to Trim() the fields, but that didn't get rid of the spaces. Must be something with the way Access wraps. Just a visual thing.

You've definitely earned that star. Too bad I can't give you a 2nd one! Thanks again.

Jim DeGeorge [wavey]
 
Kevin...thanks for giving Duane that 2nd star!

Jim DeGeorge [wavey]
 
Not sure what you mean by "little extra space between the fields". Are you talking about text boxes or text in text boxes? Is this vertical or horizontal spacing?

Duane
MS Access MVP
 
Sometimes it looks like this:

[tt]Description: This is the
description of the item.

Assessment: This is
the assessment of the item.[/tt]

And somtimes it looks like this:

[tt]
Description:
This is the
description of the item.


Assessment: This is
the assessment of the item.[/tt]

or like this:

[tt]
Description:
This is it.


Assessment: This is
the assessment of the item.[/tt]

with an extra line inbetween. Definitely in the last example, even with Trim(), there shouldn't be 2 line spaces between Description and Assessment. It's puzzling.

Jim DeGeorge [wavey]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top