by Tom Brennfleck - GUI Computing
Attaching access tables to an access database was a problem that needed to be solved. Nowhere in the VB documentation is it stated how to do this. So where do you find it?
The place I look for most database techniques is not in the Visual Basic documentation or manuals, but in a great reference source on the disk. This is found in the VB\SAMPLES directory under VISDATA. This program contains most database methods and techniques.
So, without further ado, here is the relevant snippet of attaching an access table to another access table in a different database.
Dim td As New tabledef ' attach table Dim Db As database Set DB = OpenDatabase("C:\Destination.mdb") td.Connect = ";database=c:\Source.mdb" ' Source database td.SourceTableName = "tblSource" ' Source table td.Name = "tblDestination" ' The name in your database Db.TableDefs.Append td ' Create the link