473,480 Members | 2,271 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

change data link sources in batch

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 the source one
link at a time.

I will want to provide the user with a way to switch the data source
from a form interface.

How can this be accomplished?

Thanks,

Nov 13 '05 #1
4 2981
ar****@yahoo.com wrote:
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 the source one
link at a time.

I will want to provide the user with a way to switch the data source
from a form interface.

How can this be accomplished?


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Just change the .Connect property of the TableDef object, then run the
..RefreshLink method. E.g.:

CurrentDB.TableDefs("my table").Connect = "ODBC;Driver=SQL Server;..."
CurrentDB.TableDefs("my table").RefreshLink

Of course, this should be done in a VBA module w/ error traps.

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQjesK4echKqOuFEgEQItGQCfbF7qHFWJ630oZE9JP+d9FW qL/60AoLV5
+hd/NJsFnV8oCl8oAy3Qi65G
=fp64
-----END PGP SIGNATURE-----
Nov 13 '05 #2
I will want to loop through all of my linked tables so I don't have to
input each table name in the code. How can I incorporate this method
with VBA in Access?

MGFoster wrote:
ar****@yahoo.com wrote:
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 the source one link at a time.

I will want to provide the user with a way to switch the data source from a form interface.

How can this be accomplished?
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Just change the .Connect property of the TableDef object, then run

the .RefreshLink method. E.g.:

CurrentDB.TableDefs("my table").Connect = "ODBC;Driver=SQL Server;..." CurrentDB.TableDefs("my table").RefreshLink

Of course, this should be done in a VBA module w/ error traps.

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQjesK4echKqOuFEgEQItGQCfbF7qHFWJ630oZE9JP+d9FW qL/60AoLV5
+hd/NJsFnV8oCl8oAy3Qi65G
=fp64
-----END PGP SIGNATURE-----


Nov 13 '05 #3
The linked table manager does not seem to consistently change the links
on all tables. How can I change the links for all of my linked tables/
ar****@yahoo.com wrote:
I will want to loop through all of my linked tables so I don't have to input each table name in the code. How can I incorporate this method
with VBA in Access?

MGFoster wrote:
ar****@yahoo.com wrote:
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 the
source
one link at a time.

I will want to provide the user with a way to switch the data source from a form interface.

How can this be accomplished?


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Just change the .Connect property of the TableDef object, then run

the
.RefreshLink method. E.g.:

CurrentDB.TableDefs("my table").Connect = "ODBC;Driver=SQL

Server;..."
CurrentDB.TableDefs("my table").RefreshLink

Of course, this should be done in a VBA module w/ error traps.

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQjesK4echKqOuFEgEQItGQCfbF7qHFWJ630oZE9JP+d9FW qL/60AoLV5
+hd/NJsFnV8oCl8oAy3Qi65G
=fp64
-----END PGP SIGNATURE-----


Nov 13 '05 #4
you mean you've looped through the tabledefs and reset each .Connect
property and then refreshed and it still didn't work?

How about ending the mystery and posting the code you used...

Nov 13 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
3237
by: Phil Powell | last post by:
I've read some online resources that utilize various MySQL command-line actions to migrate data from Access to MySQL. The situation is this: a group of co-workers of mine will be using an Access...
6
2879
by: Ramon M. Felciano | last post by:
Helo all -- I'm trying to gain a deeper understand for what type of semi-declarative programming can be done through XML and XPath/XSLT. I'm looking at graph processing problems as a testbed for...
6
3298
by: Alpha | last post by:
I have several textboxes that I need to chang the text when the selection row is changed in a datagrid. I have the following code. This textbox displayes the initial selection but when I click on...
2
12698
by: Sreedhar Vankayala | last post by:
Hi, I joined a project where we need to import data from a excel file into sql server via the asp.net. After doing a long research found that #1. Upload Excel file to the server #2. Load or...
2
1241
by: Gshell | last post by:
When I get to the "Choose your data connection" screen and click the down arrow by the combo box, it takes several minutes (4 or more) to present my list of two pre-existing sources. (Both of...
0
942
by: neilsanner | last post by:
Hi, I'm using VB 2005 Express Edition. I've just added a data source to my project. In the tutorial I follow (* see link below), it says that I should be able to drag a table from the data...
3
1889
by: ebrastow | last post by:
Hi folks, I'm a VB newbie - been using PowerBuilder for 12 years and thought I'd see how Visual Basic has come along these days. I'm using MS Visual Studio 2005 Professional, trying to connect...
5
2853
by: cgd | last post by:
hi, i want to save the MS Word data (not the Word file) to a database, so i copy the Word data to clipboard first,and then get the data to a DataObject object, and then try the code below, ...
0
14246
ADezii
by: ADezii | last post by:
Rather than using CurrentProject.Connection or entering your own Connection information, ADO supports storing Connection information in an external file called a Data Link File (which normally has a...
0
7048
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
7050
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7091
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...
0
5344
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4488
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
2999
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
2988
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1303
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
564
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.