Mike McCracken
asked on
Changing ACCDE how can relink to the ACCDB file
We split our database into an ACCDE - code and forms and ACCDB - data files.
After making changes to the original db how do I relink the updated ACCDE file to the ACCDB. The production ACCDB is not available to the development machine.
mlmcc
After making changes to the original db how do I relink the updated ACCDE file to the ACCDB. The production ACCDB is not available to the development machine.
mlmcc
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
mlmcc
here is the code i use:
' if the back end is password protected you can pass it by changing
' strConnect = ";DATABASE=" & dbpath
' to strConnect = ";DATABASE=" & dbpath & ";PWD=" & "your back end password" '& ;"
Dim db As DAO.Database
Dim tdf As DAO.TableDef
Dim strConnect As String
Dim dbpath As String
Dim boolresult As String
Set objDialog = CreateObject("UserAccounts .CommonDia log")
objDialog.Filter = "Back End|*.accdb"
objDialog.FilterIndex = 1
boolresult = objDialog.ShowOpen
Me.txtlocation = objDialog.FileName
dbpath = "c:/mydatabase.accdb" ' ////////////////////////// ////////// ///path to database here
strConnect = CurrentProject.Path
strConnect = ";DATABASE=" & dbpath
Set db = CurrentDb
For Each tdf In db.TableDefs
If tdf.Connect <> "" Then
tdf.Connect = strConnect
tdf.RefreshLink
End If
Next tdf
Set tdf = Nothing
Set dbs = Nothing
here is the code i use:
' if the back end is password protected you can pass it by changing
' strConnect = ";DATABASE=" & dbpath
' to strConnect = ";DATABASE=" & dbpath & ";PWD=" & "your back end password" '& ;"
Dim db As DAO.Database
Dim tdf As DAO.TableDef
Dim strConnect As String
Dim dbpath As String
Dim boolresult As String
Set objDialog = CreateObject("UserAccounts
objDialog.Filter = "Back End|*.accdb"
objDialog.FilterIndex = 1
boolresult = objDialog.ShowOpen
Me.txtlocation = objDialog.FileName
dbpath = "c:/mydatabase.accdb" ' //////////////////////////
strConnect = CurrentProject.Path
strConnect = ";DATABASE=" & dbpath
Set db = CurrentDb
For Each tdf In db.TableDefs
If tdf.Connect <> "" Then
tdf.Connect = strConnect
tdf.RefreshLink
End If
Next tdf
Set tdf = Nothing
Set dbs = Nothing
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
conagraman - where do I put this code?
Do I add it to the ACCDE file and run it after installing on the client server?
The backend database will always be in the same folder with the ACCDE file. Is there an easy way to tell it that?
mlmcc
Do I add it to the ACCDE file and run it after installing on the client server?
The backend database will always be in the same folder with the ACCDE file. Is there an easy way to tell it that?
mlmcc
ASKER
I haven't had a chance to try these since there have been no changes to the application.
The comments did remind of how to change the links manually and since they can all be done at one time I will probably do that with th enext changes.
Thanks
mlmcc
The comments did remind of how to change the links manually and since they can all be done at one time I will probably do that with th enext changes.
Thanks
mlmcc
ASKER
Thanks
mlmcc