How to use RTF control from Lebans.com?

  • Thread starter Thread starter Jeff Heikkinen
  • Start date Start date
J

Jeff Heikkinen

(This is a more detailed version of a question I posted a few days ago.)

Sorry, but I'm VERY new to Access. I have the RTF control that someone
directed me to, from http://www.lebans.com/richtext.htm#RTF2 - but I
have no idea how to actually use it! As far as I could tell, the
documentation on that site presupposed knowledge I simply don't have.

Before I forget, I'm using Access XP.

The control seems to create something like a text box, that you can type
in. I've even added it to my toolbox for designing reports and the
like. But what I type in it doesn't stay there! If I switch from
Design View to Print Preview, the preview doesn't show what I put in -
it shows the words "RTF Control Design View Window", once. Clearly
there is something I am missing here.

(I also can't see what I'm selecting. I've discovered through
experimentation that the text I drag the mouse over DOES get selected,
but it is not shown highlighted on-screen. On top of that the cursor's
apparent on-screen position isn't always the same as the position the
program treats it as being in. I consider these serious problems,
especially when combined, considering that all the functionality of that
control seems to be accessed by highlighting the text you want to change
and goign to the right-click menu. There are keyboard shortcuts listed
on the Lebans site, but not for most of the things I want to do.)

Recently I've learned that this may be the wrong approach entirely. A
kind person on another group told me:
**********
I don't have much experience with RTF controls. One thing to remember is
that many or most of them simply won't work properly on an Access form.
Assuming you have an Access-compatible one, the general idea is to bind
its RichText (or similar) property to a memo field (or OLE field if
that's what its documentation says) and set various other properties. If
the selection isn't visible, you may just need to adjust some properties
- or it may mean it has problems with your version of Access.
**********

Okay, point by point:
1. Since it was on an Access help site I assumed it was compatible with
Access. If that's not the case, what's the point of it? (serious
question) Is it compatible with my version of Access, and if not can
anyone point me to one that is?
2. I'm not sure I understand the statement about binding the RichText
property. I've looked through the properties of a Memo field I want to
change and there is no obvious way to do this.
3. That same sentence also makes it sound like I can't do what I was
originally asking about, namely mix different formats in a text box on a
report that has an *expression* in it. What I want is for a text box to
contain something like "Field1 [field2]" with the field1 part formatted
differently from the brackets and the field2 part. (I can't just do it
with two text boxes, at least not in any way I've found, since field1's
width varies considerably, and I can't find a way to make the location
of the left edge of field2's text box vary with it.)

Should I just give up on using Access for this and just use a desktop
publishing program to format this particular report?
 
Sigh.....
There's no sense berating you for stating that my control is seriously
flawed as you simply do not understand what you are talking about. Did
you even bother to look at the sample Forms and Reports? Do you
understand that you need to place the RTF2 control on a Form, bind it to
a Memo field, and then modify the Text as desired during Form View NOT
Design View?

I would suggest at this point that you give up on the idea of using a
Rich Text control. You are trying to programmatically build an RTF
string at runtime. This is not a simple process and requires knowledge
of RTF control codes.

If you just need to control the formatting of two seperate TextBox
controls, and only require a single line solution then you have two
possibilities:

1) During the Format event of the Detail section you would use the
TextWidthHeight function on my site to determine the width of your first
TextBox control. Next you would then programatically position the second
TextBox, based on the current width of the first TextBox control, to
simulate a continuous line.
http://www.lebans.com/textwidth-height.htm

2) Use the Print method of the Report object to render the contents of
your 2 TextBox controls during the Print event of the Detail section.
http://www.lebans.com/mixbold-plain.htm
Lady.zip is a database containing functions to allow the developer to
mix Bold and Plain formatting within a single Control. Demonstrates how
to use the Print method of the Report object..NEW - Feb. 18/2000

A97andA2kClaudio.zip are databases containing functions to allow the
developer to mix Bold and Plain formatting within a single Control. This
is an extension/modification to the original Lady.zip. Author Luiz
Claudio

A97Taxonomy.zip is a database containing functions to allow the
developer to mix Bold and Plain formatting within a single Control.
Demonstrates how to use the Print method of the Report object. Author
Bill Kramer

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


Jeff Heikkinen said:
(This is a more detailed version of a question I posted a few days ago.)

Sorry, but I'm VERY new to Access. I have the RTF control that someone
directed me to, from http://www.lebans.com/richtext.htm#RTF2 - but I
have no idea how to actually use it! As far as I could tell, the
documentation on that site presupposed knowledge I simply don't have.

Before I forget, I'm using Access XP.

The control seems to create something like a text box, that you can type
in. I've even added it to my toolbox for designing reports and the
like. But what I type in it doesn't stay there! If I switch from
Design View to Print Preview, the preview doesn't show what I put in -
it shows the words "RTF Control Design View Window", once. Clearly
there is something I am missing here.

(I also can't see what I'm selecting. I've discovered through
experimentation that the text I drag the mouse over DOES get selected,
but it is not shown highlighted on-screen. On top of that the cursor's
apparent on-screen position isn't always the same as the position the
program treats it as being in. I consider these serious problems,
especially when combined, considering that all the functionality of that
control seems to be accessed by highlighting the text you want to change
and goign to the right-click menu. There are keyboard shortcuts listed
on the Lebans site, but not for most of the things I want to do.)

Recently I've learned that this may be the wrong approach entirely. A
kind person on another group told me:
**********
I don't have much experience with RTF controls. One thing to remember is
that many or most of them simply won't work properly on an Access form.
Assuming you have an Access-compatible one, the general idea is to bind
its RichText (or similar) property to a memo field (or OLE field if
that's what its documentation says) and set various other properties. If
the selection isn't visible, you may just need to adjust some properties
- or it may mean it has problems with your version of Access.
**********

Okay, point by point:
1. Since it was on an Access help site I assumed it was compatible with
Access. If that's not the case, what's the point of it? (serious
question) Is it compatible with my version of Access, and if not can
anyone point me to one that is?
2. I'm not sure I understand the statement about binding the RichText
property. I've looked through the properties of a Memo field I want to
change and there is no obvious way to do this.
3. That same sentence also makes it sound like I can't do what I was
originally asking about, namely mix different formats in a text box on a
report that has an *expression* in it. What I want is for a text box to
contain something like "Field1 [field2]" with the field1 part formatted
differently from the brackets and the field2 part. (I can't just do it
with two text boxes, at least not in any way I've found, since field1's
width varies considerably, and I can't find a way to make the location
of the left edge of field2's text box vary with it.)

Should I just give up on using Access for this and just use a desktop
publishing program to format this particular report?
 
Stephen Lebans, worshipped by llamas the world over, wrote...
Sigh.....
There's no sense berating you for stating that my control is seriously
flawed

I said I hadn't found a way to get it to do what I wanted to do, and
that it seemed to be behaving oddly when I tried. I explicitly allowed
for the possibility that the problem might be between the keyboard and
the chair.
as you simply do not understand what you are talking about.

I was thinking that might be the case, and as I say, I mentioned the
possibility.
Did
you even bother to look at the sample Forms and Reports?

Yes. Since doing everything in Form view implied having to manually
format hundreds of records, which (a) is precisely what I was trying to
avoid having to do and (b) I would use a program like Word for, the
information that yielded didn't seem to be relevant to me, for reasons
you yourself point out below.
Do you
understand that you need to place the RTF2 control on a Form, bind it to
a Memo field, and then modify the Text as desired during Form View NOT
Design View?

Since that's exactly the sort of information I was *asking* for, it
stands to reason that no, I did not know that. That helps somewhat. It
implies that this can't be done as easily as I'd hoped (i.e. just get
Access to keep the formatting from the original source - at least the
line breaks for heaven's sake!) and in the case of one of the two areas
I was trying to mess with, can't be done at all, at least not without
serious coding. Not the answer I was hoping for, but that's the way it
goes sometimes.
I would suggest at this point that you give up on the idea of using a
Rich Text control. You are trying to programmatically build an RTF
string at runtime. This is not a simple process and requires knowledge
of RTF control codes.

I see. It looks like I either make do with two seperate text boxes or
use some other program, then, because there's some time pressure here
(not a lot) and I'm also a full-time student, so I simply don't have the
time - or, frankly, the inclination - to pick up the skill set it sounds
like this would require.

What I'm basically getting out of this is that Access just isn't the
right tool for the job, with or without an RTF control. That's fine.
There's no point in complaining that a hammer isn't a screwdriver.

Jeff Heikkinen said:
(This is a more detailed version of a question I posted a few days ago.)

Sorry, but I'm VERY new to Access. I have the RTF control that someone
directed me to, from http://www.lebans.com/richtext.htm#RTF2 - but I
have no idea how to actually use it! As far as I could tell, the
documentation on that site presupposed knowledge I simply don't have.

Before I forget, I'm using Access XP.

The control seems to create something like a text box, that you can type
in. I've even added it to my toolbox for designing reports and the
like. But what I type in it doesn't stay there! If I switch from
Design View to Print Preview, the preview doesn't show what I put in -
it shows the words "RTF Control Design View Window", once. Clearly
there is something I am missing here.

(I also can't see what I'm selecting. I've discovered through
experimentation that the text I drag the mouse over DOES get selected,
but it is not shown highlighted on-screen. On top of that the cursor's
apparent on-screen position isn't always the same as the position the
program treats it as being in. I consider these serious problems,
especially when combined, considering that all the functionality of that
control seems to be accessed by highlighting the text you want to change
and goign to the right-click menu. There are keyboard shortcuts listed
on the Lebans site, but not for most of the things I want to do.)

Recently I've learned that this may be the wrong approach entirely. A
kind person on another group told me:
**********
I don't have much experience with RTF controls. One thing to remember is
that many or most of them simply won't work properly on an Access form.
Assuming you have an Access-compatible one, the general idea is to bind
its RichText (or similar) property to a memo field (or OLE field if
that's what its documentation says) and set various other properties. If
the selection isn't visible, you may just need to adjust some properties
- or it may mean it has problems with your version of Access.
**********

Okay, point by point:
1. Since it was on an Access help site I assumed it was compatible with
Access. If that's not the case, what's the point of it? (serious
question) Is it compatible with my version of Access, and if not can
anyone point me to one that is?
2. I'm not sure I understand the statement about binding the RichText
property. I've looked through the properties of a Memo field I want to
change and there is no obvious way to do this.
3. That same sentence also makes it sound like I can't do what I was
originally asking about, namely mix different formats in a text box on a
report that has an *expression* in it. What I want is for a text box to
contain something like "Field1 [field2]" with the field1 part formatted
differently from the brackets and the field2 part. (I can't just do it
with two text boxes, at least not in any way I've found, since field1's
width varies considerably, and I can't find a way to make the location
of the left edge of field2's text box vary with it.)

Should I just give up on using Access for this and just use a desktop
publishing program to format this particular report?
 
Back
Top