473,388 Members | 1,376 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Change the Database that a linked table references

21
Hello,

I am using an access database to query a very large number of linked tables. Currently, the name of the database the linked tables point to is always the same name. However we are switching to a new system that uses versioned databases. Each time a new build of the database is published, a whole new database is created.

For example, we are currently on version 1847. The linked tables are set to look in "Database_1847".

A new build of the database is published as "Database_1848". The linked tables are still set to read from "Database_1847" which contains old data.

I have over 200 tables that need to be relinked to "Database_1848" and I would prefer not having to delete them and reimport them. Is there a VB command or function that can be used to update the database all my linked tables are linked to?
Jun 29 '07 #1
1 3680
Himmel
21
Found it myself. :) In case anyone else wants to know how, here ya go. I go through ODBC so I've included the ODBC reference info. I believe you can leave it off, but I'd rather not chance it. :)

Expand|Select|Wrap|Line Numbers
  1. Dim db As DAO.TableDef
  2. Dim newbuild As String
  3.  
  4. newbuild = InputBox("Please enter the database build:")
  5.  
  6. For Each db In CurrentDb.TableDefs
  7. If Len(db.Connect) > 0 Then
  8.  
  9.     db.Connect = "ODBC;DSN=ODBC_DB_NAME;DATABASE=" & newbuild
  10.     db.RefreshLink
  11.     x = x + 1
  12.  
  13. End If
  14. Next
  15. MsgBox ("Update complete." & vbCrLf & vbCrLf & x & " tables have been updated to " & newbuild & ".")
  16.  
  17.  
Jun 29 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Robert McGregor | last post by:
Hi all, I've got a Front End / Back End database that was working just fine. One day i opened the FE to find that if I tried to open one of the linked tables from the database window, nothing...
1
by: Ange T | last post by:
Hi, I have a secured Access 2000 database, and have encountered a strange error that I can't find any similar postings on. I'd really appreciate your help! In my database, I have a number of...
4
by: argniw | last post by:
I have a number of OBDC connections to SQL server tables in my access database. I want to change the data source for each of the links at once. With the linked table manager you can only change...
7
by: F. Michael Miller | last post by:
I have a db with Access front end, sql back, linked tables. I need to be able to change input masks at the table level in code. Any ideas? Thanks!
5
by: Malcolm Webb | last post by:
Hello All, I had some considerable help from people in this forum a log while ago whilst developing a databse for use in our business. The database has developed beyond my wildest dreams over...
3
by: jbsfe | last post by:
I have "Spilt" my database and the "lookup" and "seek" methods that previously worked, no longer do. I have learnd from reviewing the posts that the "lookup" and "Seek" methods cannot be used on...
4
by: danthrom | last post by:
Hi, I have a database with four tables. tbl_Client client_alias (PK, text) tbl_Matters matterID (PK, autonumber) matter (text) client_alias (foreign key, tbl_Client)
8
by: rdemyan via AccessMonster.com | last post by:
I've converted my application from A2K format to A2003 format. I tried to follow Allen Browne's protocol in getting my app into A2003 (although I was unable to find informtion on the conversion...
1
by: STUFIX | last post by:
Hi, I need to change a field name in a table stored on a backend database that is used by various queries, forms, etc on the front end client via a linked table. I can't work out how to change...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.