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
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