Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recordset Update Problem

Status
Not open for further replies.

LindaH

Programmer
Dec 12, 2001
42
US
I've got a data-bound RichTextBox control on my form. Before I update my database, I run the RichTextBox.TextRTF through a REPLACE function to replace any "\ulnone" codes with "\ul0."

sRTF = Replace(rtfTasks.TextRTF, "\ulnone", "\ul0")
rsActive("Tasks") = sRTF

After the Replace function, I have displayed the value of sRTF in a MsgBox so I can verify that the codes have been replaced. In all cases, sRTF shows correctly, but when I check the database (SQL Server) after I run this, sometimes it shows \ul0 and other times it shows \ulnone.
I can run this once and I get \ulnone in the database. I can turn around and run it again immediately, and I'll get \ul0 in the database.
Any ideas why I'm getting unpredictable results like this?

(I'm doing this because Crystal Reports doesn't recognize \ulnone, but does recognize \ul0. I tried adding a "formula" to Crystal Reports when I bring the recordset in, but I can't do a "formula" on a BLOB field. The SQL Server datatype for this field is Text.)
 
You must use the UPDATE method of recordset.

Example:

sRTF = Replace(rtfTasks.TextRTF, "\ulnone", "\ul0")
rsActive("Tasks") = sRTF
rsActive.update

ErrHandler:

if err then
rsActive.cancelupdate
end if

reidfl
 
Yes, the rsActive.update command is being executed. I'm doing a whole string of column updates before I do the rsActive.update. I just displayed the two most pertinent lines of code for this forum question.
 
The problem seems to be that rtfTasks is a data-bound control. When I unbind the control before the rsActive("Tasks") = sRTF statement, then rebind it after the update, I get the results I need.

Thanks for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top