$CaseId=$_SESSION[`CaseId`];
$qId=$_REQUEST[`QSelect`];
$rUnique=ShowQueryResultScalar("select rUnique from Responses where CaseID=`$CaseId` and qID=`$qId` and rOK=0");
$_SESSION["rUnique"]=$rUnique;
if ($qId=="")
   echo "<br><br><center><h3>Please select a question...<h3></center>";
else
   {
	$_SESSION["CaseId"]=$CaseId;
	$_SESSION["qId"]=$qId;
	$_SESSION["Instance"]=ShowQueryResultScalar("select rInstance from Responses where rUnique=`$rUnique`");
	$sql="select rValue from Responses where CaseID=`$CaseId` and qID=`VisitDate` and rInstance=".$_SESSION[`Instance`];
	$_SESSION[`VisitDate`]=ShowQueryResultScalar($sql);
	SetForm(EditResolution);
   }
$stat=1;