• Delete a relationship (Access 2000)

    Author
    Topic
    #366178

    Delete a relationship

    My problem is deleting a relationship through code. I have a function tthat delets a table in anothe r database, however i receive the message cannot delete the table isnce it is used in relationship.My table is called Products and it is related to the table Order Details in one to many relationship, i.e. the table Products has an unique ProductID number.Is there any way to put some code for deletion of the relationship before deleting the table itself?

    Dim cat As New ADOX.Catalog, objConn As New ADODB.Connection
    objConn.Open “Provider= Microsoft.Jet.OLEDB.4.0;Data Source = C:bestorebe.mdb”
    With cat
    .ActiveConnection = objConn
    .Tables.Delete “products”
    End With

    Viewing 0 reply threads
    Author
    Replies
    • #567117

      Actually, your problem us that you will orphan records in a dependent table if you succeed in deleting the relationship. Referential integrity has been enforced between the two tables. Why are you trying to violate it?

    Viewing 0 reply threads
    Reply To: Delete a relationship (Access 2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: