如何查看access中已有表间关系的名称,
我要用代码删除这个关系,必须要知道关系的名称。

解决方案 »

  1.   

    用ADOX吧'引用Microsoft ActiveX Data Objects 2.X Library
    '引用Microsoft ADO EXT. 2.8 For DDL and Security
        Dim con As New ADODB.Connection
        con.Open "provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\123.mdb;Persist Security Info=False"
        
        Dim ado As New adox.Catalog
        Set ado.ActiveConnection = con
        
        Dim xx As Long, yy As Long
        For xx = 0 To ado.Tables.Count - 1
            For yy = 0 To ado.Tables.Item(xx).Keys.Count - 1
                Debug.Print ado.Tables.Item(xx).Keys.Item(yy).Name
            Next
        Next
        
        con.Close
        Set con = Nothing