Question : Can you compare a field to nothing in a record set?

I have a record set which contains a number field called "ProductID". If the field is empty I don't want to update a table. Using the attached code the IF statement is evaluated as true and debug prints:

dupRS ProductCode =
UPDATE tblOrderDetail SET [ProductCode] =  WHERE tblOrderDetail.DetailID = 3085

What could possibly be in this field?
Can you compare a filed to nothing?
Or how do I catch it and bypass the update when the field contains nothing?

I've also tried placing a space between the quote marks in the if statement and the results were the same.
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
if Not IsNull(dupRS("ProductCode")) Or Not dupRS("ProductCode") = "" Then
.CellValue(lRow, "ProductCode") = dupRS("ProductCode")
Debug.Print "dupRS ProductCode = " & dupRS("ProductCode")
sql = "UPDATE tblOrderDetail SET [ProductCode] = " & .CellValue(lRow, "ProductCode") & " WHERE tblOrderDetail.DetailID = " & iGrid3.CellValue(lRow, "DetailID")
Debug.Print (sql)
CurrentProject.Connection.Execute sql
.DrawCell lRow, "ProductCode"
End If

Answer : Can you compare a field to nothing in a record set?

Correction:
Further since string lengths are stored in memory with the string, checking the length of a string (plus concatenating the "" to convert a null) Uses for less computer resources.
Random Solutions  
 
programming4us programming4us