以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  根据当前表(活动表)执行不同的代码  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=104475)

--  作者:蓝蚂蚁
--  发布时间:2017/7/29 23:48:00
--  根据当前表(活动表)执行不同的代码
如果当前表(活动表)为表B,执行红色的代码,如果是表C,则执行黑色的代码,根据下面的代码 ,发现不能弹出窗口1,请问老师如何解决?
If CurrentTable.name="表B" Then
    If e.Selected Then \'如果选择了值
        Dim tbl As Table = Tables("窗口1_Table1")
        If tbl.Current IsNot Nothing Then
            e.Form.DropDownBox.Value = tbl.Current("代号")
            Tables("表B").Current("编号") = tbl.Current("编号")
            Tables("表B").Current("名称") = tbl.Current("名称")
            Tables("表B").Current("单位") = tbl.Current("单位")【要录入单位,下面黑色的不要录入单位,而是要录入规格,即红色的代码只要其中部分的列名,跟黑色的代码不完全相同】
            If e.Form.DropTable IsNot Nothing Then \'如果是通过表下拉的
                e.Form.DropTable.FinishEditing()
            Else \'如果是通过窗口下拉的
                e.Form.DropDownBox.WriteValue()
            End If
        End If
    End If
End If
If CurrentTable.name="表C" Then
    If e.Selected Then \'如果选择了值
        Dim tbl As Table = Tables("窗口1_Table1")
        If tbl.Current IsNot Nothing Then
            e.Form.DropDownBox.Value = tbl.Current("代号")
            Tables("表C").Current("编号") = tbl.Current("编号")
            Tables("表C").Current("名称") = tbl.Current("名称")
            Tables("表C").Current("规格") = tbl.Current("规格")【要录入规格,不要单位,】
            If e.Form.DropTable IsNot Nothing Then \'如果是通过表下拉的
                e.Form.DropTable.FinishEditing()
            Else \'如果是通过窗口下拉的
                e.Form.DropDownBox.WriteValue()
            End If
        End If
    End If
End If

--  作者:有点甜
--  发布时间:2017/7/30 9:48:00
--  

If CurrentTable.name="表B" Then

 

改成

 

If e.Form.DropTable.Name="表B" Then