unit UBajas;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Data.DB, Data.Win.ADODB, Vcl.StdCtrls,
  Vcl.Buttons;

type
  TFBajas = class(TForm)
    BitBtn1: TBitBtn;
    OpenDialog1: TOpenDialog;
    ADOConnection1: TADOConnection;
    TNodos: TADOTable;
    Timporta: TADOTable;
    DSNodos: TDataSource;
    DSImporta: TDataSource;
    procedure BitBtn1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FBajas: TFBajas;

implementation

{$R *.dfm}

uses UElegirBaja, Udm;

procedure TFBajas.BitBtn1Click(Sender: TObject);
var
   Llave, bd: string;
 begin
if OpenDialog1.Execute then
  begin
     bd:= OpenDialog1.FileName;
      if bd <> '' then
      begin
        ADOConnection1.Connected := false;
        Llave:= 'Provider=Microsoft.ACE.OLEDB.12.0; User ID=Admin;Data Source=';
        Llave := Llave + bd + ';Mode=Share Deny None;Extended Properties="Excel 8.0;HDR=Yes;IMEX=1"';
        ADOConnection1.ConnectionString:= Llave;
        ADOConnection1.Connected:= true;
        ADOConnection1.GetTableNames(FElegirBaja.Combobox1.Items,false);
        FElegirBaja.Combobox1.Text := FElegirBaja.Combobox1.Items[0];
        FElegirBaja.Showmodal;
      end
      else
        messagedlg('El usuario canceló la operación',mtinformation,[mbok],0);

 end;
  // FElegirBaja.Showmodal;
end;

end.
