Expand|Select|Wrap|Line Numbers
- DoCmd.Hourglass (True)
- Me.cmdExitButton.Caption = "Please wait ..."
- Me.cmdExitButton.ForeColor = RGB(255, 0, 0)
- Me.Refresh
- WantedDB = IIf(Currently = "test", "live", "test") ' "Currently" was set to the current BE by function WhichBackEnd
- For Each tbl In CurrentDB.TableDefs
- If InStr(tbl.Connect, Currently) > 0 Then ' i.e. if it is a linked table
- tbl.Connect = Replace(tbl.Connect, Currently, WantedDB) ' Update the connect string test-->live or live-->test
- tbl.RefreshLink ' Relink the table
- End If
- Next
- LogActivity ("switched to")
- Me.Refresh
- ExitSub:
- DoCmd.Hourglass (False)
- Me.cmdExitButton.Caption = "Exit Database"
- Me.cmdExitButton.ForeColor = RGB(255, 255, 255)
- Exit Sub
(The Me.Refresh in line 4 doesn't appear to be necessary - it doesn't make any difference).
Does anyone have any suggestion as to why?
Peter