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: [patch 134/149] x86, paravirt: Add a global synchronization point for pvclock
    ... On Tue, 13 Jul 2010, Avi Kivity wrote: ... My bet is that dropping 'static' will fix it. ... The constraints are there, but maybe the toolchain is confused. ...
    (Linux-Kernel)
  • 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)