I have a splitted app with MS SQL database as BE (Really this will be several such apps, identical in design, but every one linked to it's own SQL BE. Every such app will serve for single site of company. All BE DB's are similar in design, but get data from different ERP databases). The connection for linking tables is created used Connection File (e.g. MyConnection.dsn). The number of linked tables/views is ~30.
Currently, when I need to create a new app for another site, after I create a new SQL DB, I make a copy from existing app, and link all tables/view in new BE to it. As all old links were renamed, now I have both old and new links in FE. Now I rename every one of new linked tables like old ones, and all old links are replaced. Together with testing, relinking all those tables takes approximately a day.
Also, there may be a situation where the the address of resource where the Connection File is stored is changed, and I have to reconnect tables. Linked Table manager has Relink option, but this allows edit the contents of Link File, not it's address or name. So for this situation also I have to relink all tables manually, and then rename links!
So now my question! Is there a way to do all this using VBA (giving name and address of old Connection File and new Connection File as parameters)?
I did something similar in Excel. After we updated to MS Office 2016, queries to tables in same Excel file (I used fixed Named Ranges as sources) did run only after they were edited, and then for current instance only (maybe the reason was, we have 64-bit Windows, but 32-bit Office because our HQ has a lot of templates for 32-bit office without any access rights, and the firm creating them nonexistent anymore). So I created an OnOpen event for such files, which did read the queries datasources, and updated them. As an additional bonus, the event also checks the address of Excel file, and in case this was changed, it updates it accordingly. With Excel it was simple - even when you use Connection File to create a link, all connection info is copied into Excel Datasource, and the Connection File itself is moot after this.
With Access, I haven't a clue from where to start!