format downloaded text within a form

J

jj

I am trying to set up a split database with the back end containing
downloaded text from my company database. I've tried inserting the text from
a csv file or from an xls file. On the desktop database, I want users to be
able to pull up this text in a form and edit it. I have downloaded the RTF2
Active X control from Mr. Lebans web site. The text in the table in the back
end database is a comment field. The data source of the RTF2 control is that
comment field. The control does not show any text. Also, I do not see the
toolbox for the ActiveX Control. Is there anyone out there who can help me
with this? I'm trying to give some users the ability to edit reports before
they are printed.
 
C

Clifford Bass

Hi jj,

Are you using Access 2007 or an earlier version? My memory of the
earlier version related to the tool box was that it might be off the screen.
Check first to make sure it is set to display (View, Toolbars, RTF2). Also,
it only displays in view mode, not in design mode. And only when you have
clicked in the control. You could try boosting your monitor's resolution,
see if it shows up. In Access 2007 it will appear in an Add-Ins ribbon when
you click into the control. Note that you can also right-click to get a
context menu.

In order for the control to show text from a field, the contents of the
field must be in RTF format.

Hope this helps,

Clifford Bass
 
J

jj

Thank you Cliff. I'm not having any luck with the toolbar. I also think
that my text may not be RTF formatted. I can do this in Excel but I don't
know how to carry it into Access. I am using 2003. I tried to follow the
samples that were included on the download site. Thanks for your input.
 
J

jj

To clarify,
I am downloading data from our central unidata database and bringing the
data into Excel. The Comments field appears in Excel as a general field. I
change it to Text. I then import the data into Access. The comments field
is changed to a memo field.

I create the form using a query that pulls from the table. I enter many of
the fields. From the ActiveX menu, I select RTF2 control and enter it into
the form. I set its source as the comments field.

The first record shows code that appears to be RTF code in the RTF control.
All of the other records show unformatted text.

I know I'm missing something.
 
H

hor vannara

Clifford Bass said:
Hi jj,

Are you using Access 2007 or an earlier version? My memory of the
earlier version related to the tool box was that it might be off the
screen.
Check first to make sure it is set to display (View, Toolbars, RTF2).
Also,
it only displays in view mode, not in design mode. And only when you have
clicked in the control. You could try boosting your monitor's resolution,
see if it shows up. In Access 2007 it will appear in an Add-Ins ribbon
when
you click into the control. Note that you can also right-click to get a
context menu.

In order for the control to show text from a field, the contents of
the
field must be in RTF format.

Hope this helps,

Clifford Bass
 
C

Clifford Bass

Hi jj,

One correction I need to make. I was testing out with an existing form
with the RTF2 control and forgot that I had code to display and hide the RTF2
tool bar depending on if the control had or did not have the current focus.

That said, if you do View, Toolbars, does RTF2 show in the list?

To deal with the fact that you are bringing in plain text and need to
convert it to RTF, here is a way that works. There may well be better ways.

Create a form named "frmToRTF" that contains an RTF2 control, named
"rtf2Work".

Create a regular module (not form, not report, not class) and place
this in it:

Public Function ToRTF(ByVal strPlainText As String) As String

With [Forms]![frmToRTF]![rtf2Work]
.PlainText = strPlainText
ToRTF = .RTFtext
End With

End Function

After you import your data make sure the frmToRTF form is open and run
an update query on the table to change any plain text comments to RTF:

UPDATE tblYourTable SET Comments = ToRTF([Comments])
WHERE Left([Comments],6)<>"{\rtf1";

Clifford Bass
 
C

Clifford Bass

Hi jj,

Just had a thought. Did you make a point to download one of his sample
RTF2 databases? If not, do so. They contain the RTF2 tool bar. Then you
can import the tool bar into your database from the sample.

Clifford Bass
 
J

jj

Thank you Clifford. I'll work with this and let you know if I'm any closer.
--
jj Trying to learn


Clifford Bass said:
Hi jj,

One correction I need to make. I was testing out with an existing form
with the RTF2 control and forgot that I had code to display and hide the RTF2
tool bar depending on if the control had or did not have the current focus.

That said, if you do View, Toolbars, does RTF2 show in the list?

To deal with the fact that you are bringing in plain text and need to
convert it to RTF, here is a way that works. There may well be better ways.

Create a form named "frmToRTF" that contains an RTF2 control, named
"rtf2Work".

Create a regular module (not form, not report, not class) and place
this in it:

Public Function ToRTF(ByVal strPlainText As String) As String

With [Forms]![frmToRTF]![rtf2Work]
.PlainText = strPlainText
ToRTF = .RTFtext
End With

End Function

After you import your data make sure the frmToRTF form is open and run
an update query on the table to change any plain text comments to RTF:

UPDATE tblYourTable SET Comments = ToRTF([Comments])
WHERE Left([Comments],6)<>"{\rtf1";

Clifford Bass

jj said:
To clarify,
I am downloading data from our central unidata database and bringing the
data into Excel. The Comments field appears in Excel as a general field. I
change it to Text. I then import the data into Access. The comments field
is changed to a memo field.

I create the form using a query that pulls from the table. I enter many of
the fields. From the ActiveX menu, I select RTF2 control and enter it into
the form. I set its source as the comments field.

The first record shows code that appears to be RTF code in the RTF control.
All of the other records show unformatted text.

I know I'm missing something.
 
J

jj

Yes I did and the sample works fine. I also imported the toolbar from the
downloaded sample. It still doesn't work. I get a message that a function
cannot be found.
 
C

Clifford Bass

Hi jj,

It looks like you need to import the "modRTF2ToolBar" module also from
the sample. That is probably the cause of the missing function message.

Clifford Bass
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top