Select Case CurrentTable.DataTable.Name
Case "客户档案"
Dim Name As String
For Each dc As Col In CurrentTable.Cols
If dc.DataCol.IsDate Then
Tables("查询").Cols("查询内容").DropForm = "万年历"
End If
Name = Name & dc.name & "|"
Tables("查询").Cols("查询项目").Combolist= Name
Next
For Each dr As Row In Tables("查询").Rows
If dr("比较") <>"" Or dr("查询内容")<>"" Then
dr("对应表")= CurrentTable.DataTable.Name
Else
dr("对应表")=""
End If
Next
Case "供应商档案"
Dim Name As String
For Each dc As Col In CurrentTable.Cols
If dc.DataCol.IsDate Then
Tables("查询").Cols("查询内容").DropForm = "万年历"
End If
Name = Name & dc.name & "|"
Tables("查询").Cols("查询项目").Combolist= Name
Next
For Each dr As Row In Tables("查询").Rows
If dr("比较") <>"" Or dr("查询内容")<>"" Then
dr("对应表")= CurrentTable.DataTable.Name
Else
dr("对应表")=""
End If
Next
End Select
老大帮忙简化一下,我是放在项目属性的CurrentTableChanged里面,道理就是切换到一个表的时候可以自动加载那个表的列名等.由于是很多表我不可能一一设置.