If e.Form.DropTable IsNot Nothing Then '如果下拉窗口是从表中打开
tr = e.Form.DropTable.Current '获取此表的当前行
Else '如果下拉窗口是通过DropdownBox打开
Dim nm As String = e.Form.DropDownBox.BindingField '获取绑定的字段
nm = nm.Split(".")(0) '获取绑定的表名
tr = Tables(nm).Current '获取此表的当前行
我现在有一个:模式窗口:添加 供应商;
双击事件如下:
Dim str() As String = {"材料维护","采购订单维护","预算计划维护","机具订单维护","采购入库维护","收支维护"}
Dim str1() As String = {"材料","采购订单","预算计划","机具订单","采购入库","收支管理"}
For i As Integer = 0 To str.Length-1
If Forms(str(i)).opened Then
Dim tbl As Table = Tables("添加供应商_Table1")
Dim dr As Row = Tables(str1(i)).Current
If dr IsNot Nothing Then
If Tables(str1(i)).Cols.Contains("供应商编号") Then
dr("供应商编号") = tbl.Current("供应商编号")
ElseIf Tables(str1(i)).Cols.Contains("单位编号") Then
dr("单位编号") = tbl.Current("供应商编号")
dr("往来单位") = tbl.Current("公司名称")
End If
e.Form.Close()
Return
End If
End If
Next
如果 能判断,是哪一个表或者TextBox,触发它弹出的,就不用写FOR EACH 遍历了。
[此贴子已经被作者于2016/12/3 16:51:57编辑过]