Pero, ¿seguimos cepillando las consultas?
Pon el código SQL, en la propiedad SQL del Query, y en tu botón te dejas de cosas raras y pones:
Código Delphi
[-]
QueryRefresh.ParamByName('agregar').AsInteger := StrToInt(txtAgregar.Text);
QueryRefresh.ParamByName('maximo').AsInteger := StrToInt(DBEDIT.Text);
QueryRefresh.ParamByName('codigo').AsInteger := StrToInttxtCodigo.Text);
QueryRefresh.ExecSQL;
// Saludos