If I'm reading you right, the code below should work for you.
Edit: However, after looking at your code again, you cannot
set a session variable within a CFQUERY tag. You need to redo your
CFIFs
after the CFQUERY and set your session variable if the CFIFs
fail.