procedure TGrid_Form.GridConnectionBeforeConnect(Sender: TIB_Connection);
 begin
  with GridConnection do begin
   if ( Protocol = cpLocal ) and not FileExists( DatabaseName ) then begin
   scMain.Execute;
  end;
 end;
end;