PDA

Click to See Complete Forum and Search --> : Renaming Linked Tables


icemanmt78
Jul 5th, 2000, 04:30 AM
I have managed to create a linked table between two access databases using standard DAO techniques.

I have a minor problem, I want to link a table from one database to another database that has a table of the same name. In which case i want to rename this link table to something else.

Does anyone know how to have the option of naming a linked table, so i don't get any naming conflictions.

Any Ideas!

Mark

honeybee
Jul 5th, 2000, 05:30 AM
What are linked tables that you are talking about?

And why do you need linked tables between two databases?

icemanmt78
Jul 5th, 2000, 06:10 AM
That was help???

I have been using dao as below

Sub Main()

Dim dbsSource As Database
Dim dbsDest As Database
Dim daotdflink As TableDef
Dim sLinkHeader As String

sLinkHeader = ";DATABASE="

Set dbsDest = OpenDatabase("C:\windows\desktop\dest.mdb")
MsgBox ("hello")
Set daotdflink = dbsDest.CreateTableDef("traffic")
daotdflink.Connect = sLinkHeader & "C:\windows\desktop\source.mdb"
daotdflink.SourceTableName = "traffic"
dbsDest.TableDefs.Append daotdflink


End Sub

To create a linked table. I want this table to be named differently in my destination database. The source database table i want to link to is called "traffic" but i want to call the linked table in my destination database LINK_traffic.

Any ideas of how to choose a name for the linked table.

JoeyCode
Jul 5th, 2000, 05:59 PM
The CreateTableDef method controls the name of the new table you're making, so you can call it whatever you want, like this:


Set daotdflink = dbsDest.CreateTableDef("LINK_traffic")


By the way, a lot of the answers to the questions you're asking in these forums can be easily found in the on-line documentation for VB or Access. You might want to read up on some of this stuff.

And you're welcome for the table linking code. No need to say thanks or anything.

-JoeyCode

honeybee
Jul 7th, 2000, 08:16 AM
Oops!
Icemanmt78, my reply was not meant to be of help to you, as I know almost nothing about the linked tables you discussed. I am sorry if I disappointed you.