Sprout Forms Confirmation Page Field Not Defined
When you set the lastEntry variable on your page. You are either setting lastEntry to be the SproutForms_FormEntryModel or null. In both cases you are defining the variable.

{# Sets lastEntry to SproutForms_FormEntryModel or null #}
{% set lastEntry = craft.sproutForms.lastEntry() %}


If you then want to test the lastEntry variable, you'll need to use something different that is defined.

I believe the following will work:

{% set lastEntry = craft.sproutForms.lastEntry() %}
{% set qualified = true %}
{% if lastEntry and lastEntry.fieldName == 'no' %}
    {% set qualified = false %}
{% endif %}


Testing for if lastEntry will work just like using if lastEntry is not null. The secondary part of your conditional should only be evaluated if if lastEntry returns true, in which case your SproutForms_FormEntryModel would exist and the fieldName field would be defined, with or without a value.