
procedure TFEditFamilys.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
var RecSave,Dig:LongInt;
Continues:Boolean;
begin
with DM do
case key of
13: begin
Continues:=True;
try
Dig:=StrToInt(EditDateBirth.T ext);
except
Continues:=False;
Application.MessageBox('Неправиный формат года
рождения...','Message',MB_OK);
EditDateBirth.Text:=copy(DateToStr(Date()),7,4);
EditDateBirth.Text;
end;
if Continues then begin
if FamilyAdd then begin
IBQID.SQL.Clear;
IBQID.SQL.Append('select Gen_ID(ID_Family,0) from Family');
IBQID.Open;
RecSave:=IBQIDGen_ID. AsInteger+1;
IBQID.Close;
IBQExecSQL.SQL.Clear;
IBQExecSQL.SQL.Append('Insert into Family (Employers,');
IBQExecSQL.SQL.Append('Relatives,');
IBQExecSQL.SQL.Append('Familys,');
IBQExecSQL.SQL.Append('DateBirth)');
IBQExecSQL.SQL.Append('Values ('+IntToStr(IBQEmployersID.AsInteger)+',');
IBQExecSQL.SQL.Append(chr(39)+Trim(EditRelatives.Text)+chr(39)+',');
IBQExecSQL.SQL.Append(chr(39)+Trim(EditFamilys.Text)+chr(39)+',');
IBQExecSQL.SQL.Append(Trim(EditDateBirth.Text)+')');
end else begin
RecSave:=IBQFamilyID.AsInteger;
IBQExecSQL.SQL.Clear;
IBQExecSQL.SQL.Append(Update Family');
IBQExecSQL.SQL.Append('Set
Relatives='+chr(39)+Trim(EditRelatives.Text)+chr(39)+',');
IBQExecSQL.SQL.Append(Tamilys-+chr(39)+Trim(EditFamilys.Text)+chr(39)+7);
IBQExecSQL.SQL.Append('DateBirth='+Trim(EditDateBirth.Text));
IBQExecSQL.SQL.Append('where ID='+IntToStr(RecSave));
end;
IBQExecSQL.ExecSQL;
IBQFamily.Close;
IBQFamily.Open;
IBQFamily.Locate('ID',RecSave,[loCaseInsensitive]);
FEditFamilys.Close;
end;
end;