title: Delphi Error Dataset not in Insert or Edit Mode, when in fact it is in Edit Mode
body: <p>I googled a lot and found also some posts here in stack overflow about the error "Dataset not in Insert or Edit Mode", but all of them occurred properly when the trying to perform an action in a dataset which is not in edit or insert mode.</p>
  
  <p>The strange problem I face here is that, even in edit mode, I'm getting this error.</p>
  
  <p>This is my code:</p>
  
  <pre><code> if DMMCI.TakeoffHistory.State in [dsInsert,dsEdit] then
      DMMCI.TakeoffHistory.Close;
  </code></pre>
  
  <p>When debugging, the "takeoddHistory.State" is "dsEdit" and so, it enters in the condition. However, at the "close" command it returns the error "Dataset not in Insert or Edit Mode".</p>