Re: modifying relationships using DAO?



You can also use DAO. The DDL statements run just the same as a DAO QueryDef.
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

Lyle Fairfield wrote:
TTBOMK one must use an ADODB connection to deal with Updates and
Constraints as in:

(dropping the existing constraint)

CurrentProject.Connection.Execute _
"ALTER TABLE [Order Details] " _
& "DROP CONSTRAINT " _
& "OrderParent "

(and rebuilding it with the OnUpdate or OnCascade attributes set)

CurrentProject.Connection.Execute _
"ALTER TABLE [Order Details] " _
& "ADD CONSTRAINT " _
& "OrderParent " _
& "FOREIGN KEY (OrderID) " _
& "REFERENCES Orders (OrderID) " _
& " ON UPDATE CASCADE " _
& " ON DELETE CASCADE"

.



Relevant Pages

  • Re: moving indexes
    ... output sql to drop ref constraints, ... run 2nd script on what's left, ... No. Dropping things is a subject I haven't dealt with enough. ... the references constraint info for those referenced by foreign keys only ...
    (comp.databases.informix)
  • Re: ADOX not deleting on first attempt
    ... Foreign Key violations? ... Stephen Howe ... constraints before dropping the table. ...
    (microsoft.public.data.ado)
  • Re: Drop all user tables + ignore constraints
    ... Uh, how about drop database, re-create, and re-create the tables? ... far easier to script out than dropping all those constraints and tables in ... and it gives errors until we drop the constraints. ...
    (microsoft.public.sqlserver.programming)
  • Re: how to drop constraints
    ... The syntax for dropping a constraint is: ... "tchangmian" wrote in message ... > constraints within the table while the table is not been dropped. ...
    (microsoft.public.sqlserver.programming)