Public Sub LinkDefects() ' Create two defects and link them Dim BugF As BugFactory Dim Bug1 As Bug, Bug2 As Bug ' tdc is a TDConnection. The user is authenticated and ' connected to the project before this routine runs. Set BugF = tdc.BugFactory ' Create two new defects. Set Bug1 = BugF.AddItem(Null) Bug1.Summary = "Lydia Bennet is 15 years old." Bug1.Status = "New" Bug1.Priority = "3-High" Bug1.Field("BG_SEVERITY") = "3-High" Bug1.DetectedBy = c_qcUser Bug1.Field("BG_DETECTION_DATE") = Date Bug1.Post Set Bug2 = BugF.AddItem(Null) Bug2.Summary = "Mr. Bennet hides in library." Bug2.Status = "New" Bug2.Priority = "3-High" Bug2.Field("BG_SEVERITY") = "3-High" Bug2.DetectedBy = c_qcUser Bug2.Field("BG_DETECTION_DATE") = Date Bug2.Post ' ' Link the new defects. Dim BugLinkF As LinkFactory Dim bugLink As Link Dim bgLinkable As ILinkable 'Cast Bug1 to ILinkable and get ' bug link factory for Bug1. Set bgLinkable = Bug1 Set BugLinkF = bgLinkable.BugLinkFactory 'Create a link between Bug1, the source entity, ' and Bug2, the target entity. Set bugLink = BugLinkF.AddItem(Bug2) bugLink.LinkType = "Related" bugLink.Post ' Show the link definition. Dim anObj As Object Set anObj = bugLink.SourceEntity Debug.Print anObj.Summary 'Lydia Bennet is 15 years old. (Bug1) Set anObj = bugLink.TargetEntity Debug.Print anObj.Summary 'Mr. Bennet hides in library. (Bug2) End Sub