473,763 Members | 1,382 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Error Setting PlainText value for RTF2 control

I have an unbound RTF2 control in an Access 2003 form which I set to
show either unformatted text or else text with words and sentences
highlighted. I do this by setting the PlainText property, getting back
the rtfText and then adding the highlighting strings and resetting
rtfText as below:

sqry = "Select * from TextContent where FileID = " & ID
Set rs = CurrentDb().Ope nRecordset(sqry , dbOpenSnapshot)
With rtfUnformatted
..rtfText = ""
If Form_QMeta.chkL ineBreak Then
sText = rs!TextContent
Else
sText = cleanup_html(rs !TextContent)
End If
..PlainText = sText

If Not chkHighlight Then Exit Sub
sRTF = .rtfText
.....

After making some other changes to the form I find I get the message
"Property is Read-Only" when trying to set the .PlainText value. I've
tried adding the control again, changing only the font size and back
colour, but cannot see what I might have done to prevent me from
setting this property.

Any help appreciated.

Simon Kravis

Mar 22 '06 #1
1 3876
The RTF control can only display RTF encoded text. If you want to simply
display plain text then wrap your plain text within the required RTF
encoding.

Here's a previous post of mine on a related issue.
http://groups.google.ca/group/micros...46dace11b9fd7e
From: Stephen Lebans - view profile
Date: Tues, Feb 14 2006 9:30 pm
Email: "Stephen Lebans"
<ForEmailGotoMy .WebSite.-WWWdotlebansdot ...@linvalid.co m>
Groups: microsoft.publi c.access.forms
Not yet ratedRating:
show options
Reply to Author | Forward | Print | Individual Message | Show original
| Report Abuse | Find messages by this author
Let me know how you make out.

Make sure your Form has:
A TextBox control named txtComment bound to the Comment field(just o you can
see the RTF encoding)
an RTF2 control bound to the Comment field
A CommandButton named cmdRTF
In your References, make sure the ref to DAO is higher in the list than ADO.
Place this code behind the Command Button.
Private Sub CmdRTF_Click()
On Error GoTo Err_CmdRTF_Clic k
Dim sRTFdata As String
Dim sHeader As String
Dim sText As String
sHeader =
"{\rtf1\ansi\an sicpg1252\deff0 \deflang1033{\f onttbl{\f0\fnil \fcharset0
Arial;}}"
sHeader = sHeader & "{\colortbl
;\red0\green0\b lue0;}\viewkind 4\uc1\pard\cf1\ fs24"
' I could have shortened the code but I wanted you(and others I refer to
this posting) to see what is happening at every step.
With Me.RecordsetClo ne
' Move to first record
.MoveFirst
' Loop until all records are processed
' This example uses a field named "Comment"
' Note this is the name of the FIELD not the
' name of the TextBox control bound to this field
Do While Not .EOF
.Edit
sText = IIf(IsNull(.Fie lds("Comment")) , "", .Fields("Commen t"))
' See if field is empty
If Len(sText & vbNullString) = 0 Then
sRTFdata = sHeader & "}"
Else
sRTFdata = sHeader & sText & "\par }"
End If
' Save our RTF encoded string back to Comment field
.Fields("Commen t") = sRTFdata
.Update
' Move to next record
.MoveNext
Loop
End With
Exit_CmdRTF_Cli ck:
Exit Sub
Err_CmdRTF_Clic k:
MsgBox Err.Description
Resume Exit_CmdRTF_Cli ck
End Sub
--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
<si***@intology .com.au> wrote in message
news:11******** *************@g 10g2000cwb.goog legroups.com...
I have an unbound RTF2 control in an Access 2003 form which I set to
show either unformatted text or else text with words and sentences
highlighted. I do this by setting the PlainText property, getting back
the rtfText and then adding the highlighting strings and resetting
rtfText as below:

sqry = "Select * from TextContent where FileID = " & ID
Set rs = CurrentDb().Ope nRecordset(sqry , dbOpenSnapshot)
With rtfUnformatted
.rtfText = ""
If Form_QMeta.chkL ineBreak Then
sText = rs!TextContent
Else
sText = cleanup_html(rs !TextContent)
End If
.PlainText = sText

If Not chkHighlight Then Exit Sub
sRTF = .rtfText
....

After making some other changes to the form I find I get the message
"Property is Read-Only" when trying to set the .PlainText value. I've
tried adding the control again, changing only the font size and back
colour, but cannot see what I might have done to prevent me from
setting this property.

Any help appreciated.

Simon Kravis

Mar 23 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2256
by: Bruce Rusk | last post by:
I've just started using Stephen Lebans' RTF2 control in a database, linked to a Memo field, and am finding it extremely useful (incidentally, in ACC2002 I'm using the class and withevents rather than the ACC97 backward-compatible module). I do have one question for Stephen or anyone else familiar with the control: what is the best way to set a default value for new entries? I am interested in doing so because I would like entries to...
4
2560
by: Marion Neubauer | last post by:
Hi! I'm using the RTF2 Control from Lebans web site with MS Access 2000. It's working very good. Now i want to create a letter with the formated text of the RTF2 control in MS Word 2000, but it shows all the code inside and not the formating ... I'm not using vba-code, i'm making the letter by hand (as a serial letter in Word with the Access-DB as data source). How can i create a letter which looks like the report in Word? Is it possible...
6
2874
by: Sharper | last post by:
I have just downloaded lebans rtf2 which initially looks very interesting. Having a little trouble though in getting the RTF2 toolbar to appear on my own db although it is on the sample. I have imported the modules correctly (i think) and am able to create a RTF2 object from form design mode>active x , but cant find the toolbar. Secondly, is it possible to import text into an RTF2 memo field from say word or excel using GET EXTERNAL...
11
4759
by: D Perron | last post by:
I am using the RTF2 activeX control from Stephen Leban's website and it works really well when there is one memo field. However, I cannot get it to work with multiple memo fields (I have 4). I saw the code for multiple memo fields and am trying to use it but not having any luck. My RTF controls on the form just show "RTF2 Control Design View Window". Any help would be appreciated.
2
1607
by: DazedAndConfused | last post by:
I converted a C# example of using dll crypt32 to VB .NET. The converted example fails when Encypting/Decypting. I found that if instead of defining a variable as and setting the values for CRYPTPROTECT_PROMPTSTRUCT; I defined the variable as IntPtr and then set it to zero CryptProtectData/CryptUnrotectData return without error. The values between the C# and VB for CRYPTPROTECT_PROMPTSTRUCT are exact except for szPrompt C# passes null...
1
1997
by: Jako | last post by:
Hi guys... Well once again I'm in a dilemma. Currently I have a RTF2 object in Access that is linked to a memo field in a table, the reason for this is so that I can have bullets and numbers in the field. The problem is however that the memo field has pritty much all the ActiveX coding in it to make the RTF2 field appear the way we assigned it. Now the main idea was to reference the content of the RTF2 field the way it appears in the...
4
10843
by: Tom | last post by:
Is it possible to encrypt a value in the my.settings area in VB.NET 2005? I.E. Can I add a settings value (via My Project / Settings) and have it encrypt that value so that if anyone looks at the resulting app.config file the value is encrypted? If so, (1) How do you specify the value to be encrypted? And (2) How do you access it now from VB? Can you still go through My.Settings?? Tom --
1
2449
by: Bob Alston | last post by:
Lebans RTF2 Active X control - How to load contents from DOC or RTF file at run time???? Bob
0
1054
by: lalob | last post by:
Hi, in an Access 2003 Application I'm using S. Leban's RTF2-Control. The data are stored in a linked Oracle-Table (varchar2(4000)). If text is used everything is working well. Now on user copied some Excel-Cells, pasted it in the RTF2 Control, and saved it in the Tabel. When I want to read this row into a ADO recordset the VBA Code doesn't go on. Access has to be canceled. Now my Question: How can I avoid to paste such Data (e.g....
0
9563
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9386
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10145
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9822
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7366
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6642
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5270
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5406
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3917
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.