unit z2;

interface

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

type
  TForm5 = class(TForm)
    DBGrid1: TDBGrid;
    DBLookupComboBox1: TDBLookupComboBox;
    Label1: TLabel;
    Button1: TButton;
    Button2: TButton;
    procedure DBLookupComboBox1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form5: TForm5;

implementation

uses datamodule, glavn, sooruzheniya, sportsmen, z1;

{$R *.dfm}

procedure TForm5.Button1Click(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 [Вид спорта].№=Тренер.вид_спорта');
  dm1.ADOQuery2.Active:=true;
end;

procedure TForm5.Button2Click(Sender: TObject);
begin
  Close;
end;

procedure TForm5.DBLookupComboBox1Click(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.
