dataset not in edit or insert mode

Delphi 3 Pro   +  Infopower

Hi,

on the line :

if table1.state in [dsinsert,dsedit] then
    table1.cancel;

I get an error : 'dataset not in edit or insert mode'  when it is in
fact "Insert"

Any Help welcome