I have a front end/back end database that I want to automatically relink on startup.

Intially I had a couple tables within it that didn't have relationships defined (they were set up through queries when needed) and I used the following function to relink the two dbs:

Option Compare Database
Option Explicit

Public Function RefreshLinkedTables()
' ************************************************** *********************
' *** Main function, called on startup. Call all initialisation
' *** code from here.
' ************************************************** *********************

Dim objRelink As clssRelinkTables
Dim sDBPath As String

' Relink the tables
Call GetDatabasePath(CurrentDb, sDBPath)

Set objRelink = New clssRelinkTables
objRelink.RelinkAllTables (sDBPath & "Testdb_DATA.mdb")

Set objRelink = Nothing

End Function

I have decided that I want to relate a couple of tables that previously didn't have defined relationships and now I get an error message saying that the table cannot be delected. This happens in the relink procedure above.

I'm thinking I just need to first delete the relationships, then relink and then set the relationships. Does this sound like the way to do this. I'm not very knowledgeable about VB and I don't know what functions to call or the syntax.