I show part of this script if recordset is not empty

I have the following script (below). I want to show the value for rte.Txt IF the recordset "rs_lttmrg" is NOT EMPTY

--

                // Create Editor instance and use Text property to load content into the RTE.  
                Dim rte
                Set rte=new RichTextEditor  

Show the value in this line below it recordset is not empty, otherwise value should be = ""

                        rte.Text=(rs_lttrmrg.Fields.Item("LtrBody").Value)



                        // Set a unique ID to Editor  
                rte.ID="editor1"  
                        rte.Width="800px"  
                        rte.Toolbar="bluedot"
                rte.MvcInit()  
                // Render Editor
                Response.Write(rte.GetString())

---

How can I do this ?
LVL 1
AleksAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

hieloCommented:
The code below should accomplish your requirement:
// Create Editor instance and use Text property to load content into the RTE.  
Dim rte
Set rte=new RichTextEditor   

' Show the value in this line below it recordset is not empty, otherwise value should be = ""
rte.Text=""
If CStr(rs_lttrmrg.Fields.Item("LtrBody").Value) <> "" Then
   rte.Text = rs_lttrmrg.Fields.Item("LtrBody").Value
End If

Open in new window


Note however, that even when rs_lttrmrg.Fields.Item("LtrBody").Value is empty, you are still setting an empty string as the value.  You might as well just skip the If clause condition.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
AleksAuthor Commented:
No go ...

ADODB.Field error '800a0bcd'

Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.

/bluedot/Intranet/qnr/Indexqnr.asp, line 212


line 212 is:  rte.Text=""

weird
0
AleksAuthor Commented:
The problem is NOT that the value of the field is "" or NULL, the problem is that the recordset is empty.
0
AleksAuthor Commented:
This seem to work.

' Show the value in this line below it recordset is not empty, otherwise value should be = ""
rte.Text=""
  If Not rs_lttrmrg.EOF Or Not rs_lttrmrg.BOF Then
   rte.Text = rs_lttrmrg.Fields.Item("LtrBody").Value
End If ' end Not rs_lttrmrg.EOF Or NOT rs_lttrmrg.BOF
0
hieloCommented:
// Create Editor instance and use Text property to load content into the RTE.  
Dim rte
Set rte=new RichTextEditor   

' Show the value in this line below it recordset is not empty, otherwise value should be = ""
rte.Text=""

If False = rs_lttrmrg.EOF Then
   If CStr(rs_lttrmrg.Fields.Item("LtrBody").Value) <> "" Then
      rte.Text = rs_lttrmrg.Fields.Item("LtrBody").Value
   End If
End If

Open in new window

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.

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.