Click to See Complete Forum and Search --> : Linking Tables


November 30th, 1999, 09:41 AM
How can I link ACCESS Database tables in VB5 using DAO.

VGopi
December 2nd, 1999, 04:37 AM
Use Relation Object , Relations collection and its properties and methods to link tables in runtime


Sample code from VB Help
' Create EmployeesDepartments Relation object, using
' the names of the two tables in the relation.
Set relNew = .CreateRelation("EmployeesDepartments", _
tdfNew.Name, tdfEmployees.Name, _

dbRelationUpdateCascade)

' Create Field object for the Fields collection of the
' new Relation object. Set the Name and ForeignName
' properties based on the fields to be used for the
' relation.
relNew.Fields.Append relNew.CreateField("DeptID")
relNew.Fields!DeptID.ForeignName = "DeptID"
.Relations.Append relNew