I've done the same thing using Development and Production back ends.
It can be as simple or complicated as you want.
I started out by using the "Linked Table Manager" in Access. If no errors, then the BE can be switched using VBA code.
My code is intermediate...I use one button and the File Dialog Picker to allow me to pick a BE anywhere, not in just one or two folders.
Here are cut down versions of my code for 2 buttons:
Code:
Private Sub btnSelectBE1_Click()
On Error GoTo Err_SelectBE
Dim d As Database
Dim T As TableDef, sFile As String
Set d = CurrentDb()
sFile = "C:\AccMdb\BE1.accdb"
For Each T In d.TableDefs
'Debug.Print t.Name & ": " & t.Properties("Connect")
If Len(T.Properties("Connect") & " ") > 1 Then
T.Properties("Connect") = ";DATABASE=" & sFile
T.RefreshLink
End If
Next
Exit_SelectBE:
Set d = Nothing
Exit Sub
Err_SelectBE:
MsgBox Err.Description
Resume Exit_SelectBE
End Sub
'-------------------
Private Sub btnSelectBE2_Click()
On Error GoTo Err_SelectBE
Dim d As Database
Dim T As TableDef, sFile As String
Set d = CurrentDb()
sFile = "C:\Project1\BE2.accdb"
For Each T In d.TableDefs
'Debug.Print t.Name & ": " & t.Properties("Connect")
If Len(T.Properties("Connect") & " ") > 1 Then
T.Properties("Connect") = ";DATABASE=" & sFile
T.RefreshLink
End If
Next
Exit_SelectBE:
Set d = Nothing
Exit Sub
Err_SelectBE:
MsgBox Err.Description
Resume Exit_SelectBE
End Sub
Links to other Relinking code:
http://access.mvps.org/access/tables/tbl0009.htm
http://access.mvps.org/access/tables/tbl0012.htm
http://allenbrowne.com/ser-01.html
http://www.jstreettech.com/cartgenie...rDownloads.asp (J Street Access Relinker)