Problem using NULL and IF THEN

# Thread: Problem using NULL and IF THEN

1. Senior Member
Join Date
Dec 1969
Posts
101

## Problem using NULL and IF THEN

How come this will not show up??<BR>&#060;%IF rsedit("datereturn") = NULL THEN%&#062;<BR> &#060;TR&#062;&#060;td&#062;Send out&#060;/td&#062;&#060;/tr&#062;<BR> &#060;TR&#062;&#060;td&#062;<BR> &#060;input type="checkbox" name="sentout" value="&#060;%if Len(trim(rsedit("sentout") & "")) = 0 then Response.write(MonthName(Month(Date)) & " " & Day(Date) & " " & Year(Date))%&#062;"&#062;&#060;/td&#062;&#060;/tr&#062;<BR>&#060;%END IF%&#062; <BR>Thanks in advance

2. Senior Member
Join Date
Dec 1969
Posts
3,195

## Because it might be something other than

NULL<BR><BR>try<BR><BR>editvalue = rsedit("datereturn")<BR>&#060;%IF IsNull(editvalue) OR len(trim(editvalue)) = 0 THEN%&#062; <BR>

3. Senior Member
Join Date
Dec 1969
Posts
96,118

## You can't use = and NULL

Look here:<BR>http://msdn.microsoft.com/library/en-us/script56/html/vsgrpcomparison.asp<BR><BR>No matter WHAT you compare with NULL, the result of the comparison is, itself, NULL.<BR><BR>You must use the ISNULL( ) function.<BR><BR> If IsNull( rsEdit("datereturn") ) Then<BR><BR>But fair warning: What is NULL in the DB isn&#039;t *necessarily* null in VBS. But give it a try.<BR><BR><BR><BR>

4. Senior Member
Join Date
Dec 1969
Posts
96,118

Look at my answer for why you can *NEVER* compare anything vs. NULL.<BR><BR>

5. Senior Member
Join Date
Dec 1969
Posts
101

## THANKS! <EOP>

.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•