Select to view content in your preferred language

How to determine if a join or relate exists - VB.NET

758
2
07-15-2010 12:02 PM
HaroldDoran
New Contributor
I've written an application for ArcMap 9.3.1 that allows users to resource shapefiles to a file geodatabase and it falls apart when it encounters a shapefile with a join or relate. The work around is to use the IDisplayRelationshipClass and set it to nothing and then re-source the data source for that layer. What I would like to do, until I get this utility to figure out the join or relate, is to test to see if a join or relate exists to notify the user that that layers' join or relate was deleted. I've searched high and low through many forums with no luck. Any suggestions/code snips to test for a join or relate would be greatly appreciated.

cheers
0 Kudos
2 Replies
PhilBlondin
Deactivated User
Public Function CheckForTableJoin(pTable As ITable) As Boolean
On Error GoTo EH
    CheckForTableJoin = False
    Dim pDRC As IDisplayRelationshipClass
    Set pDRC = pTable
        If Not pDRC.RelationshipClass Is Nothing Then
              'has a join
              CheckForTableJoin = True
            Exit Function
        End If
       
    Set pDRC = Nothing
Exit Function
EH:
    MsgBox Err.Number & Err.Description, , "CheckForTableJoin"
End Function
0 Kudos
HaroldDoran
New Contributor
Thanks Al and that was exactly what I was looking for.

cheers
harry
0 Kudos