Link to home
Start Free TrialLog in
Avatar of Mike McCracken
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
ASKER CERTIFIED SOLUTION
Avatar of DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mike McCracken
Mike McCracken

ASKER

I'll give it a try.

Thanks

mlmcc
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.CommonDialog")

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
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
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