Wrox Home  
Search P2P Archive for: Go

  Return to Index  

activex_data_objects thread: Relinking tables and queries in 2000 mdbs using VB


Message #1 by "Andy" <afaul@t...> on Tue, 2 Oct 2001 20:06:03
I had a program to relink tables and queries in 97 mdbs but it doesn't 

work with 2000 mdbs.  Why? I suspect it has something to with the Database 

object using DAO but I am not sure. The purpose of this app is to allow 

users to link tables and queries to a server of their choice.



Here is some of what I have:



Dim db as Database

dim tdf as TableDef

dim tdfs as TableDefs



set db = OpenDatabase(dbname)

set tdfs = db.TableDefs



For each tdf in tdfs

   ....

   

   sconnect = "ODBC;"

   sconnect = sconnect & "DSN=" & cbServer.Text & ";"

   sconnect = sconnect & "DATABASE=" & sDbName & ";"

   sconnect = sconnect & "APP=Microsoft Access;"

   sconnect = sconnect & "WSID=;"

   tdf.Connect = sconnect

   tdf.RefreshLink



Next
Message #2 by "Tomm Matthis" <matthis@b...> on Wed, 3 Oct 2001 09:11:55 -0400
Access defaults to using ADO... you need to set a reference to DAO in the

A2K dbs..



-- Tom



> -----Original Message-----

> From: Andy [mailto:afaul@t...]

> Sent: Tuesday, October 02, 2001 8:06 PM

> To: ActiveX_Data_Objects

> Subject: [activex_data_objects] Relinking tables and queries in 2000

> mdbs using VB

>

>

> I had a program to relink tables and queries in 97 mdbs but it doesn't

> work with 2000 mdbs.  Why? I suspect it has something to with the

> Database

> object using DAO but I am not sure. The purpose of this app is to allow

> users to link tables and queries to a server of their choice.

>

> Here is some of what I have:

>

> Dim db as Database

> dim tdf as TableDef

> dim tdfs as TableDefs

>

> set db = OpenDatabase(dbname)

> set tdfs = db.TableDefs

>

> For each tdf in tdfs

>    ....

>

>    sconnect = "ODBC;"

>    sconnect = sconnect & "DSN=" & cbServer.Text & ";"

>    sconnect = sconnect & "DATABASE=" & sDbName & ";"

>    sconnect = sconnect & "APP=Microsoft Access;"

>    sconnect = sconnect & "WSID=;"

>    tdf.Connect = sconnect

>    tdf.RefreshLink

>

> Next
Message #3 by Andy Faulkner <afaul@t...> on Wed, 3 Oct 2001 09:22:57 -0400
Okay thanks.



-----Original Message-----

From: Tomm Matthis [mailto:matthis@b...]

Sent: Wednesday, October 03, 2001 9:12 AM

To: ActiveX_Data_Objects

Subject: [activex_data_objects] RE: Relinking tables and queries in 2000

mdbs using VB





Access defaults to using ADO... you need to set a reference to DAO in the

A2K dbs..



-- Tom



> -----Original Message-----

> From: Andy [mailto:afaul@t...]

> Sent: Tuesday, October 02, 2001 8:06 PM

> To: ActiveX_Data_Objects

> Subject: [activex_data_objects] Relinking tables and queries in 2000

> mdbs using VB

>

>

> I had a program to relink tables and queries in 97 mdbs but it doesn't

> work with 2000 mdbs.  Why? I suspect it has something to with the

> Database

> object using DAO but I am not sure. The purpose of this app is to allow

> users to link tables and queries to a server of their choice.

>

> Here is some of what I have:

>

> Dim db as Database

> dim tdf as TableDef

> dim tdfs as TableDefs

>

> set db = OpenDatabase(dbname)

> set tdfs = db.TableDefs

>

> For each tdf in tdfs

>    ....

>

>    sconnect = "ODBC;"

>    sconnect = sconnect & "DSN=" & cbServer.Text & ";"

>    sconnect = sconnect & "DATABASE=" & sDbName & ";"

>    sconnect = sconnect & "APP=Microsoft Access;"

>    sconnect = sconnect & "WSID=;"

>    tdf.Connect = sconnect

>    tdf.RefreshLink

>

> Next

  Return to Index