SQL Server Performance Forum – Threads Archive
Disable the constraints…
Hi All, Is there any query to disable the relations in Access database.We can do it in SQL as below. Alter table table_name NOCHECK CONSTRAINT relation_name ‘disabling a foreign key relation
Alter table table_name CHECK CONSTRAINT relation_name ‘Reenabling a foreign Key relation Moreover how to find out the relation names in aaccess. In SQl we can find out thru query from a sys table.Is there any similar way for Access.
I am using VB 6.0 for programming. Looking forward for your replies. Thanks
You might have more luck if you post this to a dedicated Access forum
There isn’t much documentation on it, but you can actually use a lot of ALTER TABLE statements in Access – through the query window, or in VBA by executing the statement from CurrentDB().Execute <SQL statement>. If there’s any syntax that Jet doesn’t support, you will find out soon enough.
Also, in case you have a split design, and you need to alter a table in the back-end MDB, you can set a DAO.Database object to the back-end MDB, and use the Execute method from this object. You may need to add a reference to the DAO library to your project, because sadly MS has been pushing ADO since Office 2000, and DAO is no longer a default reference.
There is no disable constraint in MS Access. You have to drop/re-create it. May the Almighty God bless us all!
if you can do that with database diagrams, why do you want to do that with query?? Thanks,
Ram "It is easy to write code for a spec and walk in water, provided, both are freezed…"
Ever looked at a diagram for an Access database with lots of tables?[<img src=’/community/emoticons/emotion-1.gif’ alt=’‘ />]<br /><br />But seriously … in our front-end, we have a system update facility that will import a form from a small MDB file, then open this form: the form’s event procedures then execute VBA code, where we handle all sorts of advanced stuff that we can’t ask of regular users.
To see the relationship table, you can query the MSysRelationships table. To see this table in your database window, you have to enable Options/View/System Objects option. May the Almighty God bless us all!