Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Rich Text Box not reading data back from mysql database

Posted on 2004-08-12
Medium Priority
Last Modified: 2008-02-01
Ok, working with the Rich Text Box. I can successfully save data from the box to the database field (largetext field in mysql). The problem is I can't get it back out!  When I set the rich text box = the field it's blank.

Question by:digitalwav
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Expert Comment

ID: 11786286
Can you post the sample code so that we can look at whats wrong.

Author Comment

ID: 11786336
Ok, this routine is what I'm using for reading/writing to the tables:

Select Case SubAction

Case "Read"
rs.Open "SELECT * FROM rma WHERE id='" & vbalGrid2.CellText(iRow, 6) & "'", conn, adOpenStatic, adLockOptimistic

If IsNull(rs!rma_rmanum) = False Then Text16.Text = rs!rma_rmanum Else Text16.Text = ""
If IsNull(rs!rma_dateissued) = False Then Text17.Text = rs!rma_dateissued Else Text17.Text = ""
If IsNull(rs!rma_dateshipped) = False Then Text18.Text = rs!rma_dateshipped Else Text18.Text = ""
If IsNull(rs!rma_dateclosed) = False Then Text19.Text = rs!rma_dateclosed Else Text19.Text = ""
If IsNull(rs!rma_cmsemployee) = False Then Text20.Text = rs!rma_cmsemployee Else Text20.Text = ""
If IsNull(rs!rma_serialnum) = False Then Text21.Text = rs!rma_serialnum Else Text21.Text = ""
If IsNull(rs!rma_cmspo) = False Then Text22.Text = rs!rma_cmspo Else Text22.Text = ""
If IsNull(rs!rma_creditamt) = False Then Text23.Text = rs!rma_creditamt Else Text23.Text = ""
If IsNull(rs!rma_customerpo) = False Then Text24.Text = rs!rma_customerpo Else Text24.Text = ""
If IsNull(rs!rma_closed) = False Then Check3.Value = rs!rma_closed Else Check3.Value = 0
If IsNull(rs!rma_warranty) = False Then Check4.Value = rs!rma_warranty Else Check4.Value = 0
If IsNull(rs!rma_creditissued) = False Then Check5.Value = rs!rma_creditissued Else Check5.Value = 0
If IsNull(rs!rma_billablerepair) = False Then Check6.Value = rs!rma_billablerepair Else Check6.Value = 0
If IsNull(rs!rma_partnum) = False Then Combo2.Text = rs!rma_partnum Else Combo2.Text = ""
If IsNull(rs!rma_returnedpartgoes) = False Then Combo3.Text = rs!rma_returnedpartgoes Else Combo3.Text = ""
If IsNull(rs!rma_problem) = False Then RichTextBox2.TextRTF = rs!rma_problem Else RichTextBox2.TextRTF = ""
If IsNull(rs!rma_comments) = False Then RichTextBox3.TextRTF = rs!rma_comments Else RichTextBox3.TextRTF = ""
Text25.Text = rs!ID

Case "Write"

rs.Open "SELECT * FROM rma WHERE id='" & Text25.Text & "'", conn, adOpenStatic, adLockOptimistic ' WHERE id='" & Text25.Text & "'
'Select Case Command2.Enabled
'Case True
'Case False
'rs.Fields("rma_contactid") = Text15.Text
'End Select

If Text16.Text <> "" Then rs.Fields("rma_rmanum") = Text16.Text Else
If Text17.Text <> "" Then rs.Fields("rma_dateissued") = Text17.Text Else
If Text18.Text <> "" Then rs.Fields("rma_dateshipped") = Text18.Text Else
If Text19.Text = "" Then rs.Fields("rma_dateclosed") = Null Else rs!rma_dateclosed = Text19.Text
If Text20.Text <> "" Then rs.Fields("rma_cmsemployee") = Text20.Text Else
If Text21.Text <> "" Then rs.Fields("rma_serialnum") = Text21.Text Else
If Text22.Text <> "" Then rs.Fields("rma_cmspo") = Text22.Text Else
If Text23.Text <> "" Then rs.Fields("rma_creditamt") = Text23.Text Else
If Text24.Text <> "" Then rs.Fields("rma_customerpo") = Text24.Text Else
If Combo2.Text <> "" Then rs.Fields("rma_partnum") = Combo2.Text Else
If Combo3.Text <> "" Then rs.Fields("rma_returnedpartgoes") = Combo3.Text Else
'If RichTextBox2.TextRTF <> "" Then rs.Fields("rma_problem") = RichTextBox2.TextRTF Else
'If RichTextBox3.TextRTF <> "" Then rs.Fields("rma_comments") = RichTextBox3.TextRTF Else
rs.Fields("rma_closed") = Check3.Value
rs.Fields("rma_warranty") = Check4.Value
rs.Fields("rma_creditissued") = Check5.Value
rs.Fields("rma_billablerepair") = Check6.Value

Case "Clear"
Text16.Text = ""
Text17.Text = ""
Text18.Text = ""
Text19.Text = ""
Text20.Text = ""
Text21.Text = ""
Text22.Text = ""
Text23.Text = ""
Text24.Text = ""
Combo2.Text = ""
Combo3.Text = ""
RichTextBox2.Text = ""
RichTextBox3.Text = ""
Check3.Value = 0
Check4.Value = 0
Check5.Value = 0
Check6.Value = 0
Text25.Text = ""
Case Else

End Select

Expert Comment

ID: 11786952

So your porblem is while reading its not reading into the text box properly.
Try using Text property of RichTextBox instead of TextRTF.

Let me know
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 11787105
Tried that, same result. Also tried not specifying like this richtextbox2=rs!somefield
LVL 12

Expert Comment

by:Bob Lamberson
ID: 11790678
Hi digitalwav,
Assume you have checked the simple stuff like
    is the recordset really returning a value,
    and do you get a result when you evaluate the rs!somefield in the immediate window,
    and can you set the richtextbox to the value in the immediate window?
You might need to set a variable to the value of a field, then set the value of richtextbox to the variable.


Expert Comment

ID: 11803754
Please paste as the result of

debug.print rs!somefield

I am using RTF Fields alot but with the Access (Jet) Database. But I don't know what mySQL does with it. How do you save it?

I have checked my own programs I always have to do it that way


rs!somefield = richtextbox1


richttextbox = rs!somefield


Author Comment

ID: 11851046
This is what I ended up doing. The RTF data was being saved in the database. I could see it with an SQL exploring app.  But this is the code I found that worked for reading it back:

If RichTextBox2.TextRTF <> "" Then Adodc2.Recordset.Fields("rma_problem") = RichTextBox2.TextRTF Else
If RichTextBox2.Text <> "" Then Adodc2.Recordset.Fields("rma_probpreview") = Left$(RichTextBox2.Text, 200) Else


Accepted Solution

Computer101 earned 0 total points
ID: 12208275
PAQed, with points refunded (500)

E-E Admin

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article ( for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question