Apri il dataset:
AQ1.SQL.Clear;
AQ1.SQL.Add('SELECT docenti.COGNOME, docenti.NOME, '+
'FROM docenti '+
'WHERE NOT(docenti.IdDocPk=1) ');
AQ1.Open;
AQ1.First;
poi fai le assegnazioni

AQ1.FieldByName('IdMatFk') .AsString:= numId_Materia;
AQ1.FieldByName('IdClaFk') .AsString:=numId_ClasseDoc;
ma nella select i campi IdMatFk, IdClaFk non ci sono, non ti conviene mettere:
codice:
select * from docenti where NOT(docenti.IdDocPk=1)
N.