1.请看代码Private Sub Comdrelation_Click()
Dim rel As Relation
Set db_myfristdb = OpenDatabase("e:\student.mdb")
Set rel = db_myfristdb.CreateRelation("id", "info", "MARK")
Dim relfld As Field
Set relfld = rel.CreateField("id")
relfld.ForeignName = "id" '<-在另一个表中的字段的名字
rel.Fields.Append relfld
db_myfristdb.Relations.Append rel
db_myfristdb.CloseEnd Sub老是报告说已存在索引,不能建立关系.可是如果把"name"做主键,就没问题,这是为什么?(先前有:Set ix_studentinfo = tdb_studentinfo.CreateIndex("id")
ix_studentinfo.Primary = True
ix_studentinfo.Unique = True
Set fld_stinfo = ix_studentinfo.CreateField("id")
ix_studentinfo.Fields.Append fld_stinfo
tdb_studentinfo.Indexes.Append ix_studentinfo
db_myfristdb.TableDefs.Append tdb_studentinfo)2.dyanset & snapshot 与 table 打开方式 有何区别?非得ADO才能用前两者么?俺是菜鸟,先谢过了!