>How can i do that, i´m creating references with sql code.
>
>I need to create references with "enforce referential integrity", "cascade update related fields" and "cascade delete related rows" programaticaly.
>
>I'm using Delphi 4, how can i do it.
>
>I'm using this.
>
>ALTER TABLE Table1 ADD CONSTRAINT ConstraintName
>FOREIGN KEY (key1) REFERENCES Table2
>
>It creates the relationship between table1 and table2, but it's missing something to create cascade update and cascade delete.
You can't do it programatically but you can configure Access to cascade the updates and deletes.
From the menu, choose Tools - Relationships. Select a relation, right click on it and select Edit Relation. You can choose what items you want done. When records are deleted or updated in the Access database, the Jet engine will take care of this for you. It is not a trigger but it will do this limited job for you.
HTH.
Larry Miller
MCSD
LWMiller3@verizon.netAccumulate learning by study, understand what you learn by questioning. -- Mingjiao