Question Relink tables in access 2007 runtime mode. (1 Viewer)

ciccio83

Registered User.
Local time
Today, 15:33
Joined
Mar 19, 2009
Messages
19
I've created a software with access 2007. I've divided this one in two parts: backend (on a public directory on the local network) and frontend (distributed on different computers). All is working fine. Now: i want also to develop this software for computers without access 2007 with the "runtime" mode. It's correctly working again but, if in the future will i transfer the backend on another directory, how can i relink the backend to the frontend in runtime?! In access 2007 it's simply to do: database instrument-->relink table manager, but i really don't know how to do it in runtime mode. Thanks to all for eventually replies.
 

Dennisk

AWF VIP
Local time
Today, 14:33
Joined
Jul 22, 2004
Messages
1,649
use relinking in a module.

Here is the code I use, just set the path in the variable.

Code:
Private Sub RefreshLinks()
' DAO Data Library
    
  Dim tblDefs As TableDefs
  Dim tblDef As TableDef
  Dim strConnection As String
    
  Set tblDefs = CurrentDb.TableDefs
    
' LIVE Production Database Link
'strConnection = "\\xxxxx\xxxx\xxx\xxx\Man2\xxx\LSDBData.mdb"


  For Each tblDef In tblDefs
    If tblDef.Connect <> "" Then
      tblDef.Connect = ";DATABASE=" & strConnection
      'Debug.Print tDef.Name
      tblDef.RefreshLink
    End If
  Next tblDef
  MsgBox "Refresh Complete"
  
End Sub
 

ciccio83

Registered User.
Local time
Today, 15:33
Joined
Mar 19, 2009
Messages
19
Thank you. In runtime mode there is no way to modify a vba code. So i need a little form with a simple textbox that assign to the variable "strConnection" the right path of the backend location, right? And....this code provide to relink definitively the backend to the frontend or it is necessary to redo the operation each time i reload the software? Thank you.
 

Insane_ai

Not Really an A.I.
Local time
Today, 09:33
Joined
Mar 20, 2009
Messages
264
I use over 20 .mde implementations in my environment. When I make changes or updates, I simply recreate the MDE and copy it over the old one. You may want to consider storing the accde file(s) in a centalized storage area on your network and have the runtime users use shortcuts to those files. This way, you maintain a single copy and you won't have to rely on teh users to choose the correct location of your database housing the tables.
 

ciccio83

Registered User.
Local time
Today, 15:33
Joined
Mar 19, 2009
Messages
19
Hi Insane. Your solution is really good, nothing to say.
 

Users who are viewing this thread

Top Bottom