Rich Text Box not reading data back from mysql database

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.

HELP!!!
LVL 1
digitalwavIT Infrastructure ManagerAsked:
Who is Participating?
 
Computer101Commented:
PAQed, with points refunded (500)

Computer101
E-E Admin
0
 
kanithiCommented:
Can you post the sample code so that we can look at whats wrong.
0
 
digitalwavIT Infrastructure ManagerAuthor Commented:
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
rs.Requery

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
rs.Close

Case "Write"


rs.Open "SELECT * FROM rma WHERE id='" & Text25.Text & "'", conn, adOpenStatic, adLockOptimistic ' WHERE id='" & Text25.Text & "'
'Select Case Command2.Enabled
'Case True
'rs.Requery
'rs.MoveFirst
'Case False
'rs.AddNew
'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
rs.Update
rs.Close

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
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
kanithiCommented:
OK,

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
0
 
digitalwavIT Infrastructure ManagerAuthor Commented:
Tried that, same result. Also tried not specifying like this richtextbox2=rs!somefield
0
 
Bob LambersonSoftware EngineerCommented:
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.

Bob
0
 
HolliSttCommented:
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

SAVING:

rs!somefield = richtextbox1

LOADING:

richttextbox = rs!somefield

0
 
digitalwavIT Infrastructure ManagerAuthor Commented:
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

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.