unit z3;

interface

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

type
  TForm8 = class(TForm)
    DBGrid1: TDBGrid;
    DBLookupComboBox1: TDBLookupComboBox;
    Label1: TLabel;
    Label2: 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
  Form8: TForm8;

implementation

uses datamodule, glavn, klubs, pasport, sooruzheniya, sportsmen, z1, z2;

{$R *.dfm}

procedure TForm8.Button1Click(Sender: TObject);
begin
dm1.ADOQuery6.Active:=false;
  dm1.ADOQuery6.SQL.Clear;
  dm1.ADOQuery6.SQL.Add('SELECT спортсмены.Таб_номер, спортсмены.ФИО');
  dm1.ADOQuery6.SQL.Add('FROM Тренер INNER JOIN спортсмены ON Тренер.Таб_номер = спортсмены.Таб_номер' );
  dm1.ADOQuery6.Active:=true;
end;

procedure TForm8.Button2Click(Sender: TObject);
begin
close;
end;

procedure TForm8.DBLookupComboBox1Click(Sender: TObject);
begin
dm1.ADOQuery6.Active:=false;
  dm1.ADOQuery6.SQL.Clear;
  dm1.ADOQuery6.SQL.Add('SELECT спортсмены.Таб_номер, спортсмены.ФИО');
  dm1.ADOQuery6.SQL.Add('FROM Тренер INNER JOIN спортсмены ON Тренер.Таб_номер = спортсмены.Таб_номер' );
  dm1.ADOQuery6.SQL.Add('WHERE (((Тренер.ФИО_тренера)='''+DBLookupComboBox1.Text+'''))');
  dm1.ADOQuery6.Active:=true;
end;    
end.
