Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Rich Text Box not reading data back from mysql database

Posted on 2004-08-12
9
Medium Priority
?
444 Views
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.

HELP!!!
0
Comment
Question by:digitalwav
9 Comments
 
LVL 1

Expert Comment

by:kanithi
ID: 11786286
Can you post the sample code so that we can look at whats wrong.
0
 
LVL 1

Author Comment

by:digitalwav
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
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
 
LVL 1

Expert Comment

by:kanithi
ID: 11786952
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 1

Author Comment

by:digitalwav
ID: 11787105
Tried that, same result. Also tried not specifying like this richtextbox2=rs!somefield
0
 
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.

Bob
0
 
LVL 1

Expert Comment

by:HolliStt
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

SAVING:

rs!somefield = richtextbox1

LOADING:

richttextbox = rs!somefield

0
 
LVL 1

Author Comment

by:digitalwav
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

0
 
LVL 1

Accepted Solution

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

Computer101
E-E Admin
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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

885 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