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

display null field from recordset to textbox

Status
Not open for further replies.

jackiev

MIS
Aug 16, 2000
56
US
I know the LONG answer to this question...
Is there a short answer that I am overlooking?
Pulling a recordset from an Access database &
displaying the fields to an array of textboxes using
simple code:
while not rs.eof
textbox1(index) = rs.fields("fieldname1").value
textbox2(index) = rs.fields("fieldname2").value
... there are 20 textboxes to fill
index = index +1
wend

Problem: if any rs.field.value is null, error occurs.
LONG ANSWER:
while not rs.eof
if isnull(rs.fields("fieldname1").value) then
textbox1(index) = " "
else
textbox1(index) = rs.fields("fieldname1").value
endif
**repeat this for all 20 textboxes
index = index + 1
wend

WHAT AM I MISSING PLEASE?
 
How about

textbox1(index) = rs.fields("fieldname1").value & ""
David Paulson

 
There is a function that basically does that:

textbox1(index) = Nz(rs("fieldname1"), "")

This should work.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top