title: Syntax error when defining table with ON DELETE CASCADE
body: <p>I'm trying to use <code>ON DELETE CASCADE</code> in a FK constraint in MS Access 2007, but I'm getting an error on table definition:</p>
  
  <blockquote>
    <p>SQL Error: Syntax error in CONSTRAINT clause.</p>
  </blockquote>
  
  <p>Here's the code for creating the table:</p>
  
  <pre><code>CREATE TABLE Area (
      Id AUTOINCREMENT PRIMARY KEY, 
      AreaType__Id int NOT NULL, 
      Tbl1 text(31) NOT NULL, 
      Tbl2__Id int NOT NULL, 
      CONSTRAINT UK_Area_1 UNIQUE (Tbl1, Container__Id), 
      CONSTRAINT FK_Area_1 FOREIGN KEY (AreaType__Id) REFERENCES AreaType (Id), 
      CONSTRAINT FK_Area_2 FOREIGN KEY (Tbl2__Id) REFERENCES Tbl2 (Id) ON UPDATE CASCADE ON DELETE CASCADE
  );
  </code></pre>
  
  <p>What am I doing wrong? I looked at the Access Help, and my syntax seems correct. I've tried removing the <code>ON UPDATE CASCADE</code> portion, but got the same error. I've also tried using the default PK field for the referenced table (<code>REFERENCES Container</code> instead of <code>REFERENCES Container (Id)</code>), but again got the same error. I also searched SO, but didn't find much useful info for my situation. It's got to be something simple, but I'm not seeing it at the moment.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>It's worth mentioning, that the table definition was working properly exactly as it is, except without the <code>ON UPDATE CASCADE ON DELETE CASCADE</code> part. Only after adding the <code>CASCADE</code> parts did the error appear.</p>
  
  <p><strong>EDIT 2</strong></p>
  
  <p>In an attempt to pinpoint the problem, here is new test code that demonstrates the error:</p>
  
  <p>THIS WORKS:<br/></p>
  
  <pre><code>CREATE TABLE T1 (Id AUTOINCREMENT PRIMARY KEY);
  
  CREATE TABLE T2 (
      Id AUTOINCREMENT PRIMARY KEY, 
      T1__Id int NOT NULL, 
      CONSTRAINT FK_T2_1 FOREIGN KEY (T1__Id) REFERENCES T1 (Id)
  );
  </code></pre>
  
  <p>THIS GIVES ERROR:</p>
  
  <pre><code>CREATE TABLE T1 (Id AUTOINCREMENT PRIMARY KEY);
  
  CREATE TABLE T2 (
      Id AUTOINCREMENT PRIMARY KEY, 
      T1__Id int NOT NULL, 
      CONSTRAINT FK_T2_1 FOREIGN KEY (T1__Id) REFERENCES T1 (Id) ON DELETE CASCADE
  );
  </code></pre>
  
  <p>Can anyone replicate the error?</p>