FUNCTION FQ_GETACTIVEQUERY(FM_FORM:TFORM):TQUERY;
VAR I_INDEX:INTEGER;
BEGIN
RESULT :=NIL;
WITH FM_FORM DO
FOR I_INDEX:=0 TO COMPONENTCOUNT-1 DO
IF (COMPONENTS[I_INDEX] IS TQUERY) AND
TQUERY(COMPONENTS[I_INDEX]).ACTIVE THEN
BEGIN
RESULT :=TQUERY(COMPONENTS[I_INDEX]);
BREAK;
END;
END;