Jul 13 2024 10:09 AM
Hi All,
Is what you see in the first image below possible in MS Access? (See first image below, right side!) My goal is to merge multiple formatted text boxes into a single, coherent paragraph while retaining their distinct formatting. The software TLex exquisitely accomplishes this task as you can see.
But let's look closer at what's going on. On the left side, you have a data entry box where users can enter: definitions, translations, example sentences, notes, etc.
That info is then displayed on the right side of the screen. Notice how the styling, coloring, and formatting are all preserved. The text is not simply compiled into a list! It flows one sentence after the other, forming a coherent paragraph. THAT is what I'm trying to achieve.
I did make an attempt. The image below titled "My Version" clearly shows where I fell short. Yes, I maintained the text box formatting, but I was not able to get the text boxes to form a coherent paragraph. I also tried string concatenation, but that method does not preserve any of the text boxes' formatting.
So, has MS Access met its match? Can MS Access get text boxes to merge together while preserving the text boxes' individual formatting and form a coherent paragraph?
Hopefully, you can help. Look forward to your suggestions. Thanks in advance!
Jul 13 2024 12:19 PM - edited Jul 13 2024 12:24 PM
Hi,
In your first picture the formatting seems to be taken from the labels on the left side, not from the actual text boxes.
In your second picture it is not clear for me where the formatting comes from. I just see what could be Access text boxes but without much formatting like colors. So, what kind of settings, expressions etc. did you use in your attempt?
If you would use (Rich-Text) formatted text boxes as "source" text boxes, then you should be able to simply concatenate them with & for a combined result. e.g. as Control Source of RichTextbox3:
=[RichtTextbox1] & " " & [RichTextbox2]
Servus
Karl
****************
Access Forever
Access News
Access DevCon
Access-Entwickler-Konferenz AEK
Jul 13 2024 01:01 PM - edited Jul 13 2024 01:02 PM
Hi Karl,
You make valid points. I have tried [RichTextbox1] & “ “ & [RichTextbox1] and it did not work.
The resulting merged text field was not able to preserve the formatting of BOTH of the original text boxes that were concatenated.
This is illustrated in the images below.
The "Term" text box was clearly BLUE and BOLD, and the "PartOfSpeech" text box was clearly grey and italicized. When the two text boxes were concatenated, the second text box lost its formatting (this can be seen in the last image, which is Print Preview mode).
.
Jul 13 2024 01:50 PM - edited Jul 13 2024 01:52 PM
Hi,
In my quick test it works as expected, i.e. all formattings are preserved in the resulting text box.
Maybe you should not try to "help" us 😉 by painting the text in design view etc. but just show what you really have in design view to get this result in print preview or the other way round, i.e. a design view with the real expression (e.g. incl. the separating comma) and a matching print preview with the same three controls, spacing etc.
Servus
Karl
****************
Access News
Access Forever
Access DevCon
Access-Entwickler-Konferenz AEK
Jul 13 2024 03:54 PM
Hi Karl
Could you please provide a screen grab of your results? I would love to see them.
Regarding your request to "not try to help us by painting the text in design view," - we'll that's where you format the text. Some text I want in Blue, and other text I want in grey. Where else would I format that text if not in design view?
When I say formatting: I mean that whatever colors, italics or bolds that I have put in the textbox, that should survive concatenation.
So, if one text box looks like this: Broadway And another text box looks like this: broadway, then the results after concatenation should be: Broadwaybroadway.
But let's see your screen grab and we can take it from there.
Thanks again!
Jul 13 2024 04:39 PM - edited Jul 13 2024 04:43 PM
Hi,
> Where else would I format that text if not in design view?
Ok, now it's clear why it doesn't work for you: You are not using the assumed Rich Text (HTML) format for the fields in the table but just format the text boxes in design view of the report. So, the solution would be to use Rich Text fields.
Servus
Karl
****************
Access News
Access Forever
Access DevCon
Access-Entwickler-Konferenz AEK
Jul 13 2024 05:38 PM
Jul 13 2024 05:51 PM
Jul 13 2024 05:54 PM - edited Jul 13 2024 05:55 PM
Exactly. The text boxes concatenated.
But when that happened, the PartOfSpeech text box did not maintain its formatting/style.
That was completely lost.
Thanks so much.
Jul 13 2024 06:48 PM
Hi,
Here are screenshots of design view and print preview. Richtext4 shows how to get rid of the DIV tags to avoid line breaks.
Servus
Karl
****************
Access News
Access Forever
Access DevCon
Access-Entwickler-Konferenz AEK
Jul 13 2024 09:22 PM - edited Jul 14 2024 07:11 AM
Hi Karl,
I can't make it work. No matter what I do, it simply doesn't work for me.
Are you sure I'm supposed to be using semicolons (;) instead of commas (,)? ChatGPT flagged the code you offered as faulty because of the use of semicolons instead of commas.
Nonetheless, I tried your code (with commas, because I couldn't run the report with semicolons) and, in the end, Access did not preserve the formatting from the original text box.
Jul 14 2024 02:55 AM - edited Jul 14 2024 03:05 AM
Hi,
You absolutely wanted a real screenshot! 😉 It is from my European (German/Austrian) system where we use the semicolon as Windows List Separator. If you have e.g. North American Windows settings you use the comma.
If you want, put a tiny accdb online somewhere with just 1 table, 1 report and a few records showing your attempt and I (or others here) can have a look at what's going wrong.
Servus
Karl
****************
Access News
Access Forever
Access DevCon
Access-Entwickler-Konferenz AEK
Jul 14 2024 07:54 AM
Jul 14 2024 08:43 AM - edited Jul 14 2024 09:17 AM
Hi,
In your sample db I see that the reason why it doesn't work for you is what I wrote in a previous answer about you "painting" formats in design view:
You are not using the assumed Rich Text (HTML) format for the fields in the table but just format the text boxes in design view of the report. So, the solution would be to use Rich Text fields.
You have set Rich Text in the Text Format property of the table fields and in the report controls but you do not USE it to format the text. Instead you only set the font and color formats for the text box controls in the report. This has nothing to do with Rich Text formatting which gets saved as HTML tags in the table field itself. Read the article I linked yesterday to understand how Rich Text formatting works.
If you don't want to use Rich Text formatting as intended, you could assign the desired formatting, i.e. HTML tags, in the report by code and/or hidden controls. But that would just be a workaround.
Servus
Karl
****************
Access Forever
Access News
Access DevCon
Access-Entwickler-Konferenz AEK
Jul 14 2024 12:59 PM
Hi Karl,
I think I made some headway. (See pic on the left below.)
Yes, I technically concatenated several text boxes, each with its own formatting/coloring, etc. So that is a victory! Thank you so much. I can't tell you how many people thought this was impossible. Thanks for the link, too.
However, the changes made here only apply to the selected text. If I want to make a new entry, I have to format the text all over again and manually remove the <div> HTML tags to ensure the fields flow one after the other.
Given I will be entering hundreds, if not thousands of entries, this method would be too slow. However, I will keep using it for the time being as I continue to learn MS Access.
My goal, however, is to replicate some of the workflow happening in the TLex Software (See the right side of the pic). This software has been such a source of inspiration for me.
In TLex, you simply enter the info into the data entry text boxes, and the information is automatically displayed in its proper formatting without the need to manually select the text to change the color.
So, I suppose I'll save that venture for another day, given automating that process would likely require VBA, which I haven't learned yet.
But thank you for going on this journey with me, Karl.
Jul 14 2024 02:43 PM - edited Jul 14 2024 02:50 PM
Hi,
Well, as I said, there are potential workarounds that could fit better for you than the usual Rich Text thing. Here's one without VBA:
1 = Two textboxes bound to table fields, all without Rich Text.
2 = Two (hidden) textboxes with expressions that combine/concatenate formatting HTML tags and the content of the text fields. They also don't need to be set to Rich Text.
3 = The text box that concatenates the two hidden text boxes. This is the only one that needs to be set to Rich Text as it displays the formatting.
Servus
Karl
****************
Access News
Access Forever
Access DevCon
Access-Entwickler-Konferenz AEK