Ik wil de relaties tussen twee gelinkte tabellen van "Referentiële integriteit afdwingen" veranderen naar "Referentiële integriteit afdwingen" EN "Gerelateerde records trapsgewijs verwijderen". Dat lukt tot wanneer ik de relatie opnieuw zet. Zie groene tekst. Hier krijg ik de foutmelding: 3057 - Deze bewerking wordt niet ondersteund bij gekoppelde tabellen. Ik weet echt niet hoe dit op te lossen.
Code:
Private Sub Knop0_Click()
Dim db As DAO.Database
Dim nwrel As DAO.Relation
Dim iAttribuut As DAO.RelationAttributeEnum
Dim tblNaam As String
Set db = CurrentDb()
db.Relations.Delete ("[C:\NoizezzBE\NoizezzBE.accdb].tblSubgroeptblProductgroep")
iAttribuut = DAO.RelationAttributeEnum.dbRelationDeleteCascade And dbRelationInherited
Set nwrel = db.CreateRelation("tblSubgroeptblProductgroep", "tblSubgroep", "Kopie van tblProductgroep", dbRelationDeleteCascade And dbRelationInherited)
With nwrel
.Fields.Append .CreateField("SID")
.Fields!SID.ForeignName = "SID"
.Attributes = iAttribuut
End With
[COLOR="#008000"][FONT=Times New Roman][U]db.Relations.Append nwrel[/U][/FONT][/COLOR]
Set db = Nothing
Set nwrel = Nothing
End Sub