Define cascade from SQL

misunders2d

Registered User.
Local time
Today, 07:43
Joined
Sep 23, 2004
Messages
13
Hi, all... :)
I need to create cascade relationship on fly.
I've succeeded to create the relationship by:
ALTER TABLE tName ADD CONSTRAINT fk_id FOREIGN KEY(ID) REFERENCES tPrimary(ID)
and even succeeded to check the referential integrity by:
ALTER TABLE tName ADD CONSTRAINT fk_id FOREIGN KEY(ID) REFERENCES tPrimary(ID) CASCADE

The real problem comes when i am trying to enforce the cascades. I do not find any expression doing it.

the standarts of sql: on update cascade
or
of sql server: on update cascade go
just don't work in access :(

Thankful ahead
 
Hi, once more! :)
As far as I understood it's impossible to enforce cascades via DDL in Access. However, there's always a bypass. :)
And that's done by DAO:

Dim db As DAO.Database
Dim rel As DAO.Relation
db = OpenDatabase(strFileName)
Set rel = db.CreateRelation(strRelationName, strPrimaryTable, strSecondaryTable, dbRelationUpdateCascade + dbRelationDeleteCascade)

:p
 

Users who are viewing this thread

Back
Top Bottom