This topic is locked

Check if record exist using NULL

10/22/2013 9:41:45 AM
ASPRunnerPro General questions
M
markynewport author

Hello,
I am adding a check, if record exists in "berfore record added"

This works fine for everything except when I use NULL, if I replace NULL with anything else it works perfect...

Any help greatly appreciated....
dim rsExists

set dal_table=dal.Table("diet_main")

set rsExists = dal_table.Query("patientname='" & values("patientname") & "' and chartno='" & values("chartno") & "' and location='NULL'","")

if not rsExists.eof then

BeforeAdd=false
message = "This patient (" & values("patientname") & ") with the chart number (" & values("chartno") & ")is already on the system."
else
BeforeAdd = true
end if
rsExists.Close :
set rsExists = Nothing

Sergey Kornilov admin 10/22/2013

'NULL' is definitely wrong syntax. Depending on database you use syntax will be different i.e.

WHERE Field is NULL

or

WHERE not IsNull(Field)