By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,847 Members | 3,094 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,847 IT Pros & Developers. It's quick & easy.

Concatenating Rich Textbox Controls Into A Single File

P: n/a
Using the MS Rich Textbox Control 6.0 in Access 2000, I need to concatenate
several RTB controls into a single RTF file. Sometimes two strings will be
side-by-side; other times they need to be separated by a hard return.

For example, say I have the following 4 RTB controls in my form:

RTB1 = "abcd"
RTB2 = "efgh"
RTB3 = "ijkl"
RTB4 = "mnop"

The resulting RTF document might need to look like this:

abcdefgh

ijkl

mnop

Using the SaveFile method works great for a single RTB control. But how can
I concatenate the contents of two or more controls into a single RTF file,
and how can I insert hard returns between sets of text?

Thanks!

Neil
Jun 7 '07 #1
Share this Question
Share on Google+
10 Replies


P: n/a
On Jun 7, 11:49 am, "Neil" <nos...@nospam.netwrote:
Using the MS Rich Textbox Control 6.0 in Access 2000, I need to concatenate
several RTB controls into a single RTF file. Sometimes two strings will be
side-by-side; other times they need to be separated by a hard return.

For example, say I have the following 4 RTB controls in my form:

RTB1 = "abcd"
RTB2 = "efgh"
RTB3 = "ijkl"
RTB4 = "mnop"

The resulting RTF document might need to look like this:

abcdefgh

ijkl

mnop

Using the SaveFile method works great for a single RTB control. But how can
I concatenate the contents of two or more controls into a single RTF file,
and how can I insert hard returns between sets of text?

Thanks!

Neil
In this case, and assuming the format is constant:

wkText = RTB1 & RTB2 & vbCrLf & vbCrLf & RTB3 & vbCrLf & vbCrLf &
RTB4

vbCrLF is the VB constant shorthand for the carriage return/linefeed
combination.

You could also concatenate 'Chr$(13) & Chr$(10)' instead of the
constant. If the structure is variable, the actual concatenation
sequence will be more complex but usually solvable. The inline 'If'
statement is quite useful for these puzzles.

iif([something],"concatenate" & "some things","concatenate" & "other"
& "things")

Lucks to yas!

Ron King of Chi

Jun 7 '07 #2

P: n/a
No, we're dealing with rich textboxes here. Each box is a self-contained RTF
statement. You can't concatenate them with vbCrLf.
"King Ron" <Ki***************@covad.netwrote in message
news:11**********************@m36g2000hse.googlegr oups.com...
On Jun 7, 11:49 am, "Neil" <nos...@nospam.netwrote:
>Using the MS Rich Textbox Control 6.0 in Access 2000, I need to
concatenate
several RTB controls into a single RTF file. Sometimes two strings will
be
side-by-side; other times they need to be separated by a hard return.

For example, say I have the following 4 RTB controls in my form:

RTB1 = "abcd"
RTB2 = "efgh"
RTB3 = "ijkl"
RTB4 = "mnop"

The resulting RTF document might need to look like this:

abcdefgh

ijkl

mnop

Using the SaveFile method works great for a single RTB control. But how
can
I concatenate the contents of two or more controls into a single RTF
file,
and how can I insert hard returns between sets of text?

Thanks!

Neil

In this case, and assuming the format is constant:

wkText = RTB1 & RTB2 & vbCrLf & vbCrLf & RTB3 & vbCrLf & vbCrLf &
RTB4

vbCrLF is the VB constant shorthand for the carriage return/linefeed
combination.

You could also concatenate 'Chr$(13) & Chr$(10)' instead of the
constant. If the structure is variable, the actual concatenation
sequence will be more complex but usually solvable. The inline 'If'
statement is quite useful for these puzzles.

iif([something],"concatenate" & "some things","concatenate" & "other"
& "things")

Lucks to yas!

Ron King of Chi

Jun 8 '07 #3

P: n/a
On Jun 7, 7:08 pm, "Neil" <nos...@nospam.netwrote:
No, we're dealing with rich textboxes here. Each box is a self-contained RTF
statement. You can't concatenate them with vbCrLf.

"King Ron" <KingRonPoindex...@covad.netwrote in message

news:11**********************@m36g2000hse.googlegr oups.com...
On Jun 7, 11:49 am, "Neil" <nos...@nospam.netwrote:
Using the MS Rich Textbox Control 6.0 in Access 2000, I need to
concatenate
several RTB controls into a single RTF file. Sometimes two strings will
be
side-by-side; other times they need to be separated by a hard return.
For example, say I have the following 4 RTB controls in my form:
RTB1 = "abcd"
RTB2 = "efgh"
RTB3 = "ijkl"
RTB4 = "mnop"
The resulting RTF document might need to look like this:
abcdefgh
ijkl
mnop
Using the SaveFile method works great for a single RTB control. But how
can
I concatenate the contents of two or more controls into a single RTF
file,
and how can I insert hard returns between sets of text?
Thanks!
Neil
In this case, and assuming the format is constant:
wkText = RTB1 & RTB2 & vbCrLf & vbCrLf & RTB3 & vbCrLf & vbCrLf &
RTB4
vbCrLF is the VB constant shorthand for the carriage return/linefeed
combination.
You could also concatenate 'Chr$(13) & Chr$(10)' instead of the
constant. If the structure is variable, the actual concatenation
sequence will be more complex but usually solvable. The inline 'If'
statement is quite useful for these puzzles.
iif([something],"concatenate" & "some things","concatenate" & "other"
& "things")
Lucks to yas!
Ron King of Chi
Well that water quickly got up over my head...

I'll have to play with one o them a lil' bit and get back atchas.

R, KOC

Jun 11 '07 #4

P: n/a
What it is this group, and why is it appearing on my computer?

Yvonne Michele Anderson
yv***********@noos.fr
On 11/06/07 23:59, in article
11********************@q75g2000hsh.googlegroups.co m, "King Ron"
<Ki***************@covad.netwrote:
On Jun 7, 7:08 pm, "Neil" <nos...@nospam.netwrote:
>No, we're dealing with rich textboxes here. Each box is a self-contained RTF
statement. You can't concatenate them with vbCrLf.

"King Ron" <KingRonPoindex...@covad.netwrote in message

news:11**********************@m36g2000hse.googleg roups.com...
>>On Jun 7, 11:49 am, "Neil" <nos...@nospam.netwrote:
Using the MS Rich Textbox Control 6.0 in Access 2000, I need to
concatenate
several RTB controls into a single RTF file. Sometimes two strings will
be
side-by-side; other times they need to be separated by a hard return.
>>>For example, say I have the following 4 RTB controls in my form:
>>>RTB1 = "abcd"
RTB2 = "efgh"
RTB3 = "ijkl"
RTB4 = "mnop"
>>>The resulting RTF document might need to look like this:
>>>abcdefgh
>>>ijkl
>>>mnop
>>>Using the SaveFile method works great for a single RTB control. But how
can
I concatenate the contents of two or more controls into a single RTF
file,
and how can I insert hard returns between sets of text?
>>>Thanks!
>>>Neil
>>In this case, and assuming the format is constant:
>>wkText = RTB1 & RTB2 & vbCrLf & vbCrLf & RTB3 & vbCrLf & vbCrLf &
RTB4
>>vbCrLF is the VB constant shorthand for the carriage return/linefeed
combination.
>>You could also concatenate 'Chr$(13) & Chr$(10)' instead of the
constant. If the structure is variable, the actual concatenation
sequence will be more complex but usually solvable. The inline 'If'
statement is quite useful for these puzzles.
>>iif([something],"concatenate" & "some things","concatenate" & "other"
& "things")
>>Lucks to yas!
>>Ron King of Chi

Well that water quickly got up over my head...

I'll have to play with one o them a lil' bit and get back atchas.

R, KOC
Jun 12 '07 #5

P: n/a
Why don't you tell us. None of us have access to your computer, so we can't
tell you why the things that are on your computer are on your computer.
"Yvonne Anderson" <yv***********@noos.frwrote in message
news:C2*************************@noos.fr...
What it is this group, and why is it appearing on my computer?

Yvonne Michele Anderson
yv***********@noos.fr
On 11/06/07 23:59, in article
11********************@q75g2000hsh.googlegroups.co m, "King Ron"
<Ki***************@covad.netwrote:
>On Jun 7, 7:08 pm, "Neil" <nos...@nospam.netwrote:
>>No, we're dealing with rich textboxes here. Each box is a self-contained
RTF
statement. You can't concatenate them with vbCrLf.

"King Ron" <KingRonPoindex...@covad.netwrote in message

news:11**********************@m36g2000hse.google groups.com...

On Jun 7, 11:49 am, "Neil" <nos...@nospam.netwrote:
Using the MS Rich Textbox Control 6.0 in Access 2000, I need to
concatenate
several RTB controls into a single RTF file. Sometimes two strings
will
be
side-by-side; other times they need to be separated by a hard return.

For example, say I have the following 4 RTB controls in my form:

RTB1 = "abcd"
RTB2 = "efgh"
RTB3 = "ijkl"
RTB4 = "mnop"

The resulting RTF document might need to look like this:

abcdefgh

ijkl

mnop

Using the SaveFile method works great for a single RTB control. But
how
can
I concatenate the contents of two or more controls into a single RTF
file,
and how can I insert hard returns between sets of text?

Thanks!

Neil

In this case, and assuming the format is constant:

wkText = RTB1 & RTB2 & vbCrLf & vbCrLf & RTB3 & vbCrLf & vbCrLf &
RTB4

vbCrLF is the VB constant shorthand for the carriage return/linefeed
combination.

You could also concatenate 'Chr$(13) & Chr$(10)' instead of the
constant. If the structure is variable, the actual concatenation
sequence will be more complex but usually solvable. The inline 'If'
statement is quite useful for these puzzles.

iif([something],"concatenate" & "some things","concatenate" & "other"
& "things")

Lucks to yas!

Ron King of Chi

Well that water quickly got up over my head...

I'll have to play with one o them a lil' bit and get back atchas.

R, KOC

Jun 12 '07 #6

P: n/a
If you do not want to work directly with the RTF encoding then simply
cocatenate the values of the existing RTF controls into a new RTF control.
Use the Selxxx props/methods to select the complete contents of one control,
grab the RTF Selection, set your insertion point within the new RTF control,
set the SelText prop of the new control, and so on.
Add another control that contains nothing but a carriage retunr and follow
the same logic as above to select and copy the contents into the new
cocatenated RTF control.
--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
"King Ron" <Ki***************@covad.netwrote in message
news:11********************@q75g2000hsh.googlegrou ps.com...
On Jun 7, 7:08 pm, "Neil" <nos...@nospam.netwrote:
>No, we're dealing with rich textboxes here. Each box is a self-contained
RTF
statement. You can't concatenate them with vbCrLf.

"King Ron" <KingRonPoindex...@covad.netwrote in message

news:11**********************@m36g2000hse.googleg roups.com...
On Jun 7, 11:49 am, "Neil" <nos...@nospam.netwrote:
Using the MS Rich Textbox Control 6.0 in Access 2000, I need to
concatenate
several RTB controls into a single RTF file. Sometimes two strings
will
be
side-by-side; other times they need to be separated by a hard return.
>For example, say I have the following 4 RTB controls in my form:
>RTB1 = "abcd"
RTB2 = "efgh"
RTB3 = "ijkl"
RTB4 = "mnop"
>The resulting RTF document might need to look like this:
>abcdefgh
>ijkl
>mnop
>Using the SaveFile method works great for a single RTB control. But
how
can
I concatenate the contents of two or more controls into a single RTF
file,
and how can I insert hard returns between sets of text?
>Thanks!
>Neil
In this case, and assuming the format is constant:
wkText = RTB1 & RTB2 & vbCrLf & vbCrLf & RTB3 & vbCrLf & vbCrLf &
RTB4
vbCrLF is the VB constant shorthand for the carriage return/linefeed
combination.
You could also concatenate 'Chr$(13) & Chr$(10)' instead of the
constant. If the structure is variable, the actual concatenation
sequence will be more complex but usually solvable. The inline 'If'
statement is quite useful for these puzzles.
iif([something],"concatenate" & "some things","concatenate" & "other"
& "things")
Lucks to yas!
Ron King of Chi

Well that water quickly got up over my head...

I'll have to play with one o them a lil' bit and get back atchas.

R, KOC

Jun 12 '07 #7

P: n/a
Thanks, Stephen! That was just what I was looking for. Being a newbie with
RTFs, I didn't think to use the Sel properties. That worked great. Only one
problem.

When I concatenate two pieces of text that are supposed to be in the same
paragraph, side by side, they end up with a hard return between them.

For example, RTF1="abc" and RTF2="def", and I want the result to be
"abcdef". Instead I get:

abc
def

Here's my code (rtfCompilation is the control being used for concatenation):

Me.rtfCompilation = ""

Me.rtf1.SelStart = 0
Me.rtf1.sellength = Len(Me.rtf1)
Me.rtfCompilation.SelText = Me.rtf1.SelRTF

Me.rtf2.SelStart = 0
Me.rtf2.sellength = Len(Me.rtf2)
Me.rtfCompilation.SelStart = Len(Me.rtfCompilation)
Me.rtfCompilation.SelText = Me.rtf2.SelRTF

I also tried the above with Me.rtfCompilation.SelStart =
Len(Me.rtfCompilation) + 1. Results were the same.

Thanks!

Neil
"Stephen Lebans" <ForEmailGotoMy.WebSite.-WWWdotlebansdot...@linvalid.com>
wrote in message news:46**********************@news.aliant.net...
If you do not want to work directly with the RTF encoding then simply
cocatenate the values of the existing RTF controls into a new RTF control.
Use the Selxxx props/methods to select the complete contents of one
control, grab the RTF Selection, set your insertion point within the new
RTF control, set the SelText prop of the new control, and so on.
Add another control that contains nothing but a carriage retunr and follow
the same logic as above to select and copy the contents into the new
cocatenated RTF control.
--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
"King Ron" <Ki***************@covad.netwrote in message
news:11********************@q75g2000hsh.googlegrou ps.com...
>On Jun 7, 7:08 pm, "Neil" <nos...@nospam.netwrote:
>>No, we're dealing with rich textboxes here. Each box is a self-contained
RTF
statement. You can't concatenate them with vbCrLf.

"King Ron" <KingRonPoindex...@covad.netwrote in message

news:11**********************@m36g2000hse.google groups.com...

On Jun 7, 11:49 am, "Neil" <nos...@nospam.netwrote:
Using the MS Rich Textbox Control 6.0 in Access 2000, I need to
concatenate
several RTB controls into a single RTF file. Sometimes two strings
will
be
side-by-side; other times they need to be separated by a hard return.

For example, say I have the following 4 RTB controls in my form:

RTB1 = "abcd"
RTB2 = "efgh"
RTB3 = "ijkl"
RTB4 = "mnop"

The resulting RTF document might need to look like this:

abcdefgh

ijkl

mnop

Using the SaveFile method works great for a single RTB control. But
how
can
I concatenate the contents of two or more controls into a single RTF
file,
and how can I insert hard returns between sets of text?

Thanks!

Neil

In this case, and assuming the format is constant:

wkText = RTB1 & RTB2 & vbCrLf & vbCrLf & RTB3 & vbCrLf & vbCrLf &
RTB4

vbCrLF is the VB constant shorthand for the carriage return/linefeed
combination.

You could also concatenate 'Chr$(13) & Chr$(10)' instead of the
constant. If the structure is variable, the actual concatenation
sequence will be more complex but usually solvable. The inline 'If'
statement is quite useful for these puzzles.

iif([something],"concatenate" & "some things","concatenate" & "other"
& "things")

Lucks to yas!

Ron King of Chi

Well that water quickly got up over my head...

I'll have to play with one o them a lil' bit and get back atchas.

R, KOC


Jun 13 '07 #8

P: n/a
"Yvonne Anderson" <yv***********@noos.frwrote
What it is this group, and why is it appearing on my computer?
This is a USENET newsgroup devoted to questions and answers about Microsoft
Access.

The only reason I can think that it would be appearing on your computer is
that you, or someone else, selected it in your newsreader software. If you
are in the habit of logging on to your computer and then walking away, that
could explain it.

But, in any case, if you open your newsreader and take appropriate steps to
unsubscribe, it should go away.

Larry Linson
Microsoft Access MVP
Jun 13 '07 #9

P: n/a
You're a better person than me, Larry. :-)

"Larry Linson" <bo*****@localhost.notwrote in message
news:fKMbi.3563$or4.1434@trnddc06...
"Yvonne Anderson" <yv***********@noos.frwrote
>What it is this group, and why is it appearing on my computer?

This is a USENET newsgroup devoted to questions and answers about
Microsoft Access.

The only reason I can think that it would be appearing on your computer is
that you, or someone else, selected it in your newsreader software. If
you are in the habit of logging on to your computer and then walking away,
that could explain it.

But, in any case, if you open your newsreader and take appropriate steps
to unsubscribe, it should go away.

Larry Linson
Microsoft Access MVP

Jun 13 '07 #10

P: n/a
Hey, Stephen. Well, I stumbled upon the solution to my problem with unwanted
hard returns appearing between two segements of concatenated text (previous
message). Seems that the "" I put at the beginning of the code (to clear the
compilation rich textbox control) was causing it.

Thus, changing the code from this:

Me.rtfCompilation = ""

Me.rtf1.SelStart = 0
Me.rtf1.sellength = Len(Me.rtf1)
Me.rtfCompilation.SelText = Me.rtf1.SelRTF

Me.rtf2.SelStart = 0
Me.rtf2.sellength = Len(Me.rtf2)
Me.rtfCompilation.SelStart = Len(Me.rtfCompilation)
Me.rtfCompilation.SelText = Me.rtf2.SelRTF

to this:

Me.rtf1.SelStart = 0
Me.rtf1.sellength = Len(Me.rtf1)
Me.rtfCompilation = Me.rtf1.SelRTF

Me.rtf2.SelStart = 0
Me.rtf2.sellength = Len(Me.rtf2)
Me.rtfCompilation.SelStart = Len(Me.rtfCompilation)
Me.rtfCompilation.SelText = Me.rtf2.SelRTF

resolved the problem. (Removed the first line and changed the fourth line
from "rtfCompilation.SelText =" to "rtfCompilation =".)

Still not sure why the "" at the beginning caused the extra hard return to
appear at the end of that block. But at least it's cleared up.

<>

On a separate note, I realized that since I'm concatenating the entire
contents of the controls, that I could just use the TextRTF property, rather
than the SelRTF property. Thus, I modified the above code further to:

Me.rtfCompilation = Me.rtf1.TextRTF
Me.rtfCompilation.SelStart = Len(Me.rtfCompilation)
Me.rtfCompilation.SelText = Me.rtf2.TextRTF

Do you see any problem with that?

Thanks!!

Neil

"Stephen Lebans" <ForEmailGotoMy.WebSite.-WWWdotlebansdot...@linvalid.com>
wrote in message news:46**********************@news.aliant.net...
If you do not want to work directly with the RTF encoding then simply
cocatenate the values of the existing RTF controls into a new RTF control.
Use the Selxxx props/methods to select the complete contents of one
control, grab the RTF Selection, set your insertion point within the new
RTF control, set the SelText prop of the new control, and so on.
Add another control that contains nothing but a carriage retunr and follow
the same logic as above to select and copy the contents into the new
cocatenated RTF control.
--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
"King Ron" <Ki***************@covad.netwrote in message
news:11********************@q75g2000hsh.googlegrou ps.com...
>On Jun 7, 7:08 pm, "Neil" <nos...@nospam.netwrote:
>>No, we're dealing with rich textboxes here. Each box is a self-contained
RTF
statement. You can't concatenate them with vbCrLf.

"King Ron" <KingRonPoindex...@covad.netwrote in message

news:11**********************@m36g2000hse.google groups.com...

On Jun 7, 11:49 am, "Neil" <nos...@nospam.netwrote:
Using the MS Rich Textbox Control 6.0 in Access 2000, I need to
concatenate
several RTB controls into a single RTF file. Sometimes two strings
will
be
side-by-side; other times they need to be separated by a hard return.

For example, say I have the following 4 RTB controls in my form:

RTB1 = "abcd"
RTB2 = "efgh"
RTB3 = "ijkl"
RTB4 = "mnop"

The resulting RTF document might need to look like this:

abcdefgh

ijkl

mnop

Using the SaveFile method works great for a single RTB control. But
how
can
I concatenate the contents of two or more controls into a single RTF
file,
and how can I insert hard returns between sets of text?

Thanks!

Neil

In this case, and assuming the format is constant:

wkText = RTB1 & RTB2 & vbCrLf & vbCrLf & RTB3 & vbCrLf & vbCrLf &
RTB4

vbCrLF is the VB constant shorthand for the carriage return/linefeed
combination.

You could also concatenate 'Chr$(13) & Chr$(10)' instead of the
constant. If the structure is variable, the actual concatenation
sequence will be more complex but usually solvable. The inline 'If'
statement is quite useful for these puzzles.

iif([something],"concatenate" & "some things","concatenate" & "other"
& "things")

Lucks to yas!

Ron King of Chi

Well that water quickly got up over my head...

I'll have to play with one o them a lil' bit and get back atchas.

R, KOC


Jun 13 '07 #11

This discussion thread is closed

Replies have been disabled for this discussion.