Changing relation object

A

AJC

Hi,

I need to send out a piece of code to fix a problem on multiple databases
where within the relationships for the tables, one of the relationships
doesn't have the option ticked for "cascade updates" in referential
integrity.

I thought it would be straight forward!

Here is my attempt below, the code loops through each of the relationships
until it finds the right one and then should set the Attributes to the
correct value for "dbRelationUpdateCascade Updates will cascade":

For i = 0 To ThisDB.Relations.Count - 1

Set ThisRel = ThisDB.Relations(i)

If ThisRel.Table = "tblNASMaster" And ThisRel.ForeignTable =
"tblMicroQuest" Then

'This is the relationship that needs updating
If ThisRel.Attributes = 33554432 Then

ThisRel.Attributes = 33554688

End If



End If

I get:

Run-time error '3219'

Invalid operation

Any thoughts would be greatly appreciated.

Cheers

Andy
 
A

Allen Browne

I think you will have to delete the relation, and recreate it with the
desired attributes.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top