if (CTNOS!='' and CTNOS IS NOT null) then
-------
把“CTNOS!='' and ”去掉