Use the function IsNull() to check, instead of if object = null/nothing