Connecting Tech Pros Worldwide Forums | Help | Site Map

change data link sources in batch

argniw@yahoo.com
Guest
 
Posts: n/a
#1: Nov 13 '05
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,


MGFoster
Guest
 
Posts: n/a
#2: Nov 13 '05

re: change data link sources in batch


argniw@yahoo.com wrote:[color=blue]
> 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?[/color]

-----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-----
argniw@yahoo.com
Guest
 
Posts: n/a
#3: Nov 13 '05

re: change data link sources in batch


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:[color=blue]
> argniw@yahoo.com wrote:[color=green]
> > I have a number of OBDC connections to SQL server tables in my[/color][/color]
access[color=blue][color=green]
> > 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[/color][/color]
one[color=blue][color=green]
> > link at a time.
> >
> > I will want to provide the user with a way to switch the data[/color][/color]
source[color=blue][color=green]
> > from a form interface.
> >
> > How can this be accomplished?[/color]
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Just change the .Connect property of the TableDef object, then run[/color]
the[color=blue]
> .RefreshLink method. E.g.:
>
> CurrentDB.TableDefs("my table").Connect = "ODBC;Driver=SQL[/color]
Server;..."[color=blue]
> 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-----[/color]

argniw@yahoo.com
Guest
 
Posts: n/a
#4: Nov 13 '05

re: change data link sources in batch


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/


argniw@yahoo.com wrote:[color=blue]
> I will want to loop through all of my linked tables so I don't have[/color]
to[color=blue]
> input each table name in the code. How can I incorporate this method
> with VBA in Access?
>
> MGFoster wrote:[color=green]
> > argniw@yahoo.com wrote:[color=darkred]
> > > I have a number of OBDC connections to SQL server tables in my[/color][/color]
> access[color=green][color=darkred]
> > > database. I want to change the data source for each of the links[/color][/color][/color]
at[color=blue][color=green][color=darkred]
> > > once. With the linked table manager you can only change the[/color][/color][/color]
source[color=blue]
> one[color=green][color=darkred]
> > > link at a time.
> > >
> > > I will want to provide the user with a way to switch the data[/color][/color]
> source[color=green][color=darkred]
> > > from a form interface.
> > >
> > > How can this be accomplished?[/color]
> >
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> >
> > Just change the .Connect property of the TableDef object, then run[/color]
> the[color=green]
> > .RefreshLink method. E.g.:
> >
> > CurrentDB.TableDefs("my table").Connect = "ODBC;Driver=SQL[/color]
> Server;..."[color=green]
> > 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-----[/color][/color]

pietlinden@hotmail.com
Guest
 
Posts: n/a
#5: Nov 13 '05

re: change data link sources in batch


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...

Closed Thread