Solved

Rich Text Box not reading data back from mysql database

Posted on 2004-08-12
9
415 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
Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 
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:BobLamberson
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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

777 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