unit z2;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Grids, DBGrids, DBCtrls, StdCtrls;

type
  TForm5 = class(TForm)
    DBGrid1: TDBGrid;
    DBComboBox1: TDBComboBox;
    procedure DBComboBox1Change(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form5: TForm5;

implementation

uses datamodule, glavn, sooruzheniya, sportsmen, z1;

{$R *.dfm}

procedure TForm5.DBComboBox1Change(Sender: TObject);
begin
 dm1.ADOQuery2.Active:=false;
  dm1.ADOQuery2.SQL.Clear;
  dm1.ADOQuery2.SQL.Add('select Тренер.ФИО_тренера');
  dm1.ADOQuery2.SQL.Add('from [Вид спорта], Тренер' );
  dm1.ADOQuery2.SQL.Add('where [Вид спорта].№=Тренер.вид_спорта and [Вид спорта].вид_спорта='''+DBLookupComboBox1.Text+'''');
  dm1.ADOQuery2.Active:=true;
end;

end.
