Hola...
¿Exactamente en que línea te produce el error?
Ese error indica que estás tratan de acceder a una pocisión que no existe en una lista.
Ahora, este pedazo de código:
Código Delphi
[-]
while not query3.eof do
begin
if query3.fieldbyname('det_valor').AsInteger=1 then
begin
sgEvaluacion.cells[2,x]:=query3.fieldbyname('det_valor').asstring;
end
else
if query3.fieldbyname('det_valor').AsInteger=2 then
begin
sgEvaluacion.cells[3,x]:=query3.fieldbyname('det_valor').asstring;
end
else
if query3.fieldbyname('det_valor').AsInteger=3 then
begin
sgEvaluacion.cells[4,x]:=query3.fieldbyname('det_valor').asstring;
end
else
if query3.FieldByName('det_valor').AsInteger=4 then
begin
sgEvaluacion.cells[5,x]:=query3.fieldbyname('det_valor').asstring;
end
else
if query3.fieldbyname('det_valor').AsInteger=5 then
begin
sgEvaluacion.cells[6,x]:=query3.fieldbyname('det_valor').asstring;
end
end;
Bien lo podrías hacer así:
Código Delphi
[-]
var
Valor: Integer;
begin
Valor := query3.fieldbyname('det_valor').AsInteger;
sgEvaluacion.cells[Valor + 1, x] := IntToStr(Valor);
Edición:
Ya revisando bien tu código, veo que incrementas en dos lugares la variable
x y recorres
query1 y dentro del ciclo de
query1 recorres
query2. También en el ciclo de
query3 veo que no haces un
query3.Next, por lo al entrar a ese ciclo la aplicación debe quedar "colgada", ya que es un ciclo infinito.
Saludos...