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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Working with Null Fields

Status
Not open for further replies.

dongledell

Technical User
Dec 10, 2002
26
GB
Hi,

I have my asp page running OK, now I am trying to refine it. What I would like to do is only include a certain table row if there is any information in the corresponding field in the recordset. I'd also like to format any text to ensure line breaks are included.

here's the code I was using:

<% if Not IsNull(scheme.Fields.Item(&quot;lendnote&quot;).Value) then %>
<tr>
<td width=&quot;200&quot; valign=&quot;top&quot;><b>Notes</b></td>
<td><%=replace(scheme.Fields.Item(&quot;lendnote&quot;).Value , vbCrLf , &quot;<br>&quot;)%><br>&nbsp;</td>
</tr>
<%end if %>

only it does not work.

If the field scheme(&quot;lendnote&quot;) contains info, it simply puts nothing up, no row.

If the field scheme(&quot;lendnote&quot;) doesn't contains anything, it errors saying &quot;invalid use of null&quot;??!!

Ive tried various other methods but with no joy.

Any ideas?!
 
try this

If Len(scheme(&quot;lendnote&quot;))>0 Then

instead of

if Not IsNull(scheme.Fields.Item(&quot;lendnote&quot;).Value)

hth

simon

ps fields, item, and value are all defaults in asp
 
Many thanks! A combination of that and one other modification has made it work perfectly!

On the second modification I had to make, The database was designed using access, and that field was assigned the type &quot;memo&quot;.

with it set at memo, although the if statement would write the table row it would not write the field value.

Once I had changed the assignment of the field in the database table to &quot;text&quot; it worked fine? Anyone know why this is?
 
I think for the memo Field you would needed getChunk method

scheme.Fields.Item(&quot;lendnote&quot;).GetChunk(scheme.Fields.Item(&quot;lendnote&quot;).ActualSize)

________
George, M
 
Shaddow: that Getchunk() is on our radar now! [bigglasses]

(completely new to me before thread333-773785

hth,
Foxbox
ttmug.gif
 
That's why i love Tek-Tips. I can still find something that i could learn :).

________
George, M
 
LOL Shaddow - it would be very surprising if I couldn't learn something new each time I come here - only really been doing ASP for a month or so and it's all a bit confusing ;)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top