How do I combine a Text and Memo Field

leblanc9425

Registered User.
Local time
Today, 13:25
Joined
May 8, 2013
Messages
22
I am having trouble creating a specifically formatted report. Let me start by saying I am learning Access...slowly. I have a basic understanding of macros and VBA expressions, so I am willing to try anything.

Anyway, I have two fields: [Title] (plain text) and [Description] (memo). I want to combine the two but have the Title bold underlined but not the Description. I want it to look like this:

This is the Title. And this is the decription part that could go on for many, many more lines...

I have tried combining the two fields like: =[Title] & [Description] but if I set the properly to underline, then the whole thing is underlined.

Since the Title will vary in length, I cannot just underline the Title and then put the Description field next to it.

I know this is probably simple, but I just cannot seem to figure it out. Any help would be greatly appreciated.
 
Why do you need to combine into one field?

What is to stop you setting the description control below the title field control?

However if you want to do this then you need to prefix and suffix the title value with the codes for bold and underline - what the codes are depends on whether you are using pre/post Access 2003 since it changed at that point.

If post 2003 the code would be something like

"<b><ul>" & yrTtlVal & "</b></ul><div>"
 
CJ, thanks for responding and offering som suggestions. To answer your question, I do not need to actually combine the two fields, but just format the output so that they appear to be combined.

Your second comment about setting the Description control below the Title field control is exactly how I am doing it now, but this puts the Title on one line of the report and the Description on the next. So, there is a blank space from the end of the Title to the next line.

How do I set the prefix and suffix Title Value?? I tried to add this into the Control Source like:

="<b><ul>" & Trim([Title]) & "</b></ul></div>" & ":" & ([Description])

It is almost there! Everything is combined but the underline tag does not seem to work.
 
I would look online under html for the underline tag - I was guessing at <ul>.

It is not something I have really worked on before but there also may be a tag required as the very first item in the total data.

I'm assuming you are using 2007/10. If you are using 2003 or earlier then the 'tags' are rtf rather than html so completely different.

In html </div> is the equvalent of a linefeed

Sorry I can't be more help
 
CJ, thanks a million. You pointed me in the right direction and after a bit of trial and error, I now have it formatted the way they want it.

Here is what I did:
1) left the [Descripiton] field itself as text
2) in the report, made both the [Title] and [Description] fields as RTF
3) in the Detail portion of the report, I used the following code as the Control Source:

="<B><U><I>" & Trim([Title]) & "</u><b>: " & Trim([Description])

This produced a Title that was bold, italized, and underlined, followed by the Description that was bold and italized but NOT underlined. I cannot explain why, but I had to use the <b> tag to get the description re-bolded.

Anyway, thanks for the help.
 
I'm not strong in this area but I think html tags are case sensitive so <B> is different from <b>.

I'm just starting to do some work in this area (building a text editor using rich text) so I guess I'll find out soon enough!
 
You were very close but you need to wrap all of the variables if you want them to have the same formatting.


="<b><u><i>" & Trim([Title]) & ": " & Trim([Description]) & "</i></u></b>"

If you want different formatting:

="<b><u><i>" & Trim([Title]) & "</u></i>: " & Trim([Description]) & "</b>"

And it is a good idea to always close each formatting code just in case you don't want that formatting to carry forward to other text in the rich text field.

One other suggestion, I always test for null before concatenating fields so it does not look strange having floating punctuation or spaces preceding text.
 

Users who are viewing this thread

Back
Top Bottom