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

how to judge a field in a recordset is empty?

Status
Not open for further replies.

longmatch

Programmer
Nov 1, 2001
406
I am writing a program to present data to end user. How can I know that which field is empty? see my code below:If Not rsReport.EOF Then
strTable = &quot;<TABLE align = &quot;&quot;center&quot;&quot; BORDER=&quot;&quot;1&quot;&quot; CELLSPACING=&quot;&quot;3&quot;&quot; CELLPADDING=&quot;&quot;3&quot;&quot;>&quot;
strTable = strTable & &quot;<TR>&quot;
strTable = strTable & &quot; <TH bgcolor='#b0c4de'>Resident Name</TH>&quot;
strTable = strTable & &quot; <TH bgcolor='#b0c4de'>Submit Date</TH>&quot;
strTable = strTable & &quot;</TR>&quot;

Do While Not rsReport.EOF
strTable = strTable & &quot;<TR ALIGN=CENTER>&quot;
strTable = strTable & &quot; <TD>&quot; & rsReport(&quot;Resident&quot;) & &quot;</TD>&quot;
if rsReport(&quot;tDay&quot;) = empty then
rsReport(&quot;tday&quot;) = &quot;not submitted&quot;
end if
strTable = strTable & &quot; <TD>&quot; & rsReport(&quot;tDay&quot;) & &quot;</TD>&quot;
strTable = strTable & &quot;</TR>&quot;
rsReport.MoveNext
Loop
end if


Thanks

Haijun

 
Hi there,
Test the field for a null value if you are allowing null values in the fields, replace this:

if rsReport(&quot;tDay&quot;) = empty then

with

if rsReport(&quot;tDay&quot;) Is Null then

cheers
tty0

 
Or you can also do this i beleive

Replace

if rsReport(&quot;tDay&quot;) = empty then

With

if rsReport(&quot;tDay&quot;) = &quot;&quot; then
 
I used
if isNull(rsResport(&quot;tday&quot;)) then
it works.

haijun
 
Small tip for the field values,

Don't forget that null and an empty string are two different values

therefore &quot;&quot; and NULL are different, best be safe than sorry and check for both if your fields allow for zero length and null mate. 'mi casa es su casa'
]-=tty0=-[
ICQ:82621399
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top