automatic find backend

basilyos

Registered User.
Local time
Today, 14:23
Joined
Jan 13, 2014
Messages
252
helllo i have a splitted database

one Frontend and Two backend any solution to let the Frontend check on load two destinations and the right one will be the backend

i dont want something ready if you can lead me i really appreciate
 

G37Sam

Registered User.
Local time
Tomorrow, 01:23
Joined
Apr 23, 2008
Messages
454
here you go, you can run ifs and conditions to choose which backend you want

Code:
Dim tdf As TableDef
Dim strBackEnd As String
For Each tdf In db.TableDefs
    strBackEnd = "INSERT YOUR DATABASE LINK HERE"
    Set tdf = db.TableDefs(tdf.Name)
    tdf.Connect = strBackEnd
    tdf.RefreshLink
Next tdf
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 17:23
Joined
Feb 19, 2002
Messages
42,976
The only way to automatically "find" a BE is if you put it somewhere known like in the same folder as the FE but in a split, multi-user database that doesn't work since you will not be sharing the same FE. The FE will be located on the user's local PC but the BE must be on the server to be shared. What problem are you trying to solve?
 

alphonseg

New member
Local time
Today, 17:23
Joined
May 31, 2021
Messages
5
Why do you need to switch back ends? I wonder if there may be a better solution.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 17:23
Joined
Feb 19, 2002
Messages
42,976
For development, we switch BE's all the time and usually use the linked tables manager to do it. But users should never be switching BE's. When you make modifications and put out a new version, YOU fix the links. The user doesn't do it.
 

Isaac

Lifelong Learner
Local time
Today, 14:23
Joined
Mar 14, 2017
Messages
8,738
helllo i have a splitted database

one Frontend and Two backend any solution to let the Frontend check on load two destinations and the right one will be the backend

i dont want something ready if you can lead me i really appreciate

What do you actually mean by "check on load two destinations and the right one will be the backend" ?
What should the "check" actually DO ? How do you define "the right one"? What does "will be the backend" mean--it becomes the back end, meaning you need to link all the tables between FE and BE? Or you just want to check that it exists, or what?

Please re-write in a clearer more detailed way
 

basilyos

Registered User.
Local time
Today, 14:23
Joined
Jan 13, 2014
Messages
252
hey again,

to be more clear

i made a splitted database

i installed the backend on a server (main computer)
and i installed the front on three other computers in the same office

the owner of the business always ask me to make some updates and to be free i always work from home so i have to take a copy from the backend an of course i have to relink the tables so the database work
after finishing from the updates i have to copy the backend again to the server and relinkthe tables between thebackend and the frontend and also copy the frontend to the three other computers


so my question and i hope that i can make my problem clear

could i put a code on the login form to check the backend location before running the database

when the login form open it will check two places for example
place 1 - \\10.20.20.1\Database\backend.accdb
place 2- D:\Database\backend.accdb

on my pc the database will find the backend on drive d automatically and when i copy the backend again to server the stuff will openthe database automatically without relinking the tables
 

Isaac

Lifelong Learner
Local time
Today, 14:23
Joined
Mar 14, 2017
Messages
8,738
Thanks for the additional information. So I have a question for you.

Why can't you just:
  1. Take the BE copy home with you, make design changes
  2. Back at the job, Copy the BE file (which you changed at home) into the folder of the BE at the job - leave filename the exact same, and Replace existing file
Open FE ... All your design changes will be recognized...You don't even need to do a TableDefs("name").RefreshLink, nor a TableDefs.Refresh on the collection - the FE will recognize the changes made to the linked Access table in the BE without doing anything.
 

basilyos

Registered User.
Local time
Today, 14:23
Joined
Jan 13, 2014
Messages
252
Thanks for the additional information. So I have a question for you.

Why can't you just:
  1. Take the BE copy home with you, make design changes
  2. Back at the job, Copy the BE file (which you changed at home) into the folder of the BE at the job - leave filename the exact same, and Replace existing file
Open FE ... All your design changes will be recognized...You don't even need to do a TableDefs("name").RefreshLink, nor a TableDefs.Refresh on the collection - the FE will recognize the changes made to the linked Access table in the BE without doing anything.
Yes your totally right

But am so sorry coz i forgot to mention that sometimes i have to edit the frontend so here i want to solve the problem of linking the tables

Am really sorry for not giving all the information at the same time and thanks for helping me
 

Isaac

Lifelong Learner
Local time
Today, 14:23
Joined
Mar 14, 2017
Messages
8,738
Yes your totally right

But am so sorry coz i forgot to mention that sometimes i have to edit the frontend so here i want to solve the problem of linking the tables

Am really sorry for not giving all the information at the same time and thanks for helping me
Let me stop here too and make sure I understand what you're saying. You mean that, once you get back to your job, you have a new edited version of both the back end and the front end, so you need code in the front end that simply deletes all of the linked tables and then relinks them to the job location of the back end, rather than where they are linked to currently which is the home version of the back end? Is that right?
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 05:23
Joined
May 7, 2009
Messages
19,169
how about a service db.
you can run it in a usb drive.
on the form, just fill first the FE and on the
datasheet save the location of the BE.
 

Attachments

  • BackEndSwitch.accdb
    480 KB · Views: 277

Users who are viewing this thread

Top Bottom