dbTalk Databases Forums  

Change Data Source for All Objects

comp.databases.ms-access comp.databases.ms-access


Discuss Change Data Source for All Objects in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
steph
 
Posts: n/a

Default Change Data Source for All Objects - 02-22-2008 , 06:20 AM






Hello,

I've got this supposedly easy problem of redirecting all of the linked
tables and pass-through queries from reading from production-database
to test-database. Unfortunately I'm no real access-hero.

The setup is the following: There's an access-2003 mdb-file containing
lots of objects, some of which point to an oracle-database via an odbc-
connection. Now I want all of the things accessing Oracle, namely
linked tables and pass-through queries, to read from another
database.

So I redirected the ODBC data-source to point to the other database -
only to realize that apparently the pass-through queries still read
from the previous database - the connection information apparently
being kept within the access-objects. This puzzled me. Now I've tried
to programmatically update all connection-attributes. But still no
sucess.

So, please: can anybody give me a hint on how to induce all access-
objects to use the current ODBC data-source settings and not the old
settings. I want them all to read from my Oracle testdatabase and not
from production database.

thanks and regards,
stephan

Reply With Quote
  #2  
Old   
Terry Kreft
 
Posts: n/a

Default Re: Change Data Source for All Objects - 02-22-2008 , 11:22 AM






You need to update the connect property and then use the Refreshlink method

So (short form)

Dim db as DAO.Database
Dim Tab as DAO.Tabledef

Set DB = Currentdb

For Each Tab in db.TableDefs
With Tab
If Len(.Connect) > 0 then
.Connect = "Your new connect string"
.RefreshLink
End If
End With
Next


--
Terry Kreft


"steph" <stephan0h (AT) yahoo (DOT) de> wrote

Quote:
Hello,

I've got this supposedly easy problem of redirecting all of the linked
tables and pass-through queries from reading from production-database
to test-database. Unfortunately I'm no real access-hero.

The setup is the following: There's an access-2003 mdb-file containing
lots of objects, some of which point to an oracle-database via an odbc-
connection. Now I want all of the things accessing Oracle, namely
linked tables and pass-through queries, to read from another
database.

So I redirected the ODBC data-source to point to the other database -
only to realize that apparently the pass-through queries still read
from the previous database - the connection information apparently
being kept within the access-objects. This puzzled me. Now I've tried
to programmatically update all connection-attributes. But still no
sucess.

So, please: can anybody give me a hint on how to induce all access-
objects to use the current ODBC data-source settings and not the old
settings. I want them all to read from my Oracle testdatabase and not
from production database.

thanks and regards,
stephan



Reply With Quote
  #3  
Old   
steph
 
Posts: n/a

Default Re: Change Data Source for All Objects - 02-26-2008 , 03:27 AM



On 22 Feb., 18:22, "Terry Kreft" <terry.kr... (AT) mps (DOT) co.uk> wrote:
Quote:
You need to update the connect property and then use the Refreshlink method

So (short form)

Dim db as DAO.Database
Dim Tab as DAO.Tabledef

Set DB = Currentdb

For Each Tab in db.TableDefs
With Tab
If Len(.Connect) > 0 then
.Connect = "Your new connect string"
.RefreshLink
End If
End With
Next

--
Terry Kreft

"steph" <stepha... (AT) yahoo (DOT) de> wrote in message

news:2fb21b0d-e95b-404f-ad54-4431c8f2db1f (AT) s19g2000prg (DOT) googlegroups.com...

Hello,

I've got this supposedly easy problem of redirecting all of the linked
tables and pass-through queries from reading from production-database
to test-database. Unfortunately I'm no real access-hero.

The setup is the following: There's an access-2003 mdb-file containing
lots of objects, some of which point to an oracle-database via an odbc-
connection. Now I want all of the things accessing Oracle, namely
linked tables and pass-through queries, to read from another
database.

So I redirected the ODBC data-source to point to the other database -
only to realize that apparently the pass-through queries still read
from the previous database - the connection information apparently
being kept within the access-objects. This puzzled me. Now I've tried
to programmatically update all connection-attributes. But still no
sucess.

So, please: can anybody give me a hint on how to induce all access-
objects to use the current ODBC data-source settings and not the old
settings. I want them all to read from my Oracle testdatabase and not
from production database.

thanks and regards,
stephan
Thanks,

Already solved the problem - similar to your solution. Thanks!


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.