以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]撤销按钮不执行  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=100639)

--  作者:cd_tdh
--  发布时间:2017/5/15 17:01:00
--  [求助]撤销按钮不执行

撤销不执行

插入按钮代码如下:

Dim sort As String = Tables("工程款申请").sort
Dim r As Row = Tables("工程款申请").Current
Tables("工程款申请").AllowMerge =False
Tables("工程款申请").sort = ""
Dim nr As Row = Tables("工程款申请").InsertNew
    nr.Move(r.Index + 0)
Dim cs() As String = {"序号","项目编码","所属机构","项目名称","建设单位","合同金额","合同工期","开工日期","竣工日期"}
For Each c As String In cs
  nr(c) = r(c)
Next
Tables("工程款申请").AllowMerge = True
Tables("工程款申请").Sort = "序号,项目编码,所属机构"

 

撤销按钮代码如下:

With Tables("工程款申请")
    If .Current IsNot Nothing Then
        .Current.Reject()
    End If
End With
\'恢复合模式
Tables("工程款申请").AllowMerge = True
Tables("工程款申请").Sort = "序号,项目编码,所属机构"

 

现在撤销按钮撤销不了新插入的行。

[此贴子已经被作者于2017/5/15 17:01:32编辑过]

--  作者:有点色
--  发布时间:2017/5/15 18:18:00
--  

 用一个变量记录新增的行

 

vars("新增的行") = nr

 

 那么,移除的时候可以写

 

If vars("新增的行") isnot nothing Then

    vars("新增的行").Reject()

End If