Hola Caro.
He podido solucionar el tema, aunque he empleado otra forma.
Te adjunto el código para que le des un repaso, a ver que tal.
Código Delphi
[-]
unit pruebazebal2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, DBTables, StdCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Memo1: TMemo;
Button1: TButton;
DataSource1: TDataSource;
DataSource2: TDataSource;
Table1: TTable;
Table2: TTable;
procedure Button1Click(Sender: TObject);
procedure Edit1KeyPress(Sender: TObject; var Key: Char);
private
public
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
Close;
end;
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
var
respuesta : String;
respuesta2 : String;
begin
If Key=#13 then
begin
Table1.Open;
If Table1.Locate('palabra',Edit1.Text, [loCaseInsensitive]) then
begin
respuesta := Table1.fieldByName('NUMERO').AsString;
end;
Table1.Close;
Table2.Open;
If Table2.Locate('NUMERO',respuesta,[loCaseInsensitive]) then
begin
respuesta2 := Table2.fieldByName('RESPUESTA').AsString;
end;
Table2.Close;
Memo1.Lines.Add(Edit1.Text);
Memo1.Lines.Add(respuesta2);
Edit1.Text :='';
end;
end;
end.
Muchas gracias.
Manuel