以文本方式查看主题 - Foxtable(狐表) (http://www.foxtable.com/bbs/index.asp) -- 专家坐堂 (http://www.foxtable.com/bbs/list.asp?boardid=2) ---- 箱号数据会大了 2 (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=173341) |
|
-- 作者:edisontsui -- 发布时间:2021/11/25 11:54:00 -- 箱号数据会大了 2 If e.DataCol.Name = "票号年月客户" Dim idx As Integer = Tables(e.DataTable.Name).FindRow(e.DataRow) If idx > 0 Then e.DataRow("票号年月客户") = DataTables(e.DataTable.Name).dataRows(idx - 1)("票号年月客户") e.DataRow("箱号") = e.DataTable.compute("max(箱号)","票号年月客户=\'" & e.DataRow("票号年月客户") & "\'") + 1 End If End If 上面的代码是放在 datacolchanged 里面的,执行之后, 新的箱号比旧的箱号数据会大了2,比如前面一行是 1,新的一行就是 3, 再加一行就是 5。请问是哪里的问题呢?
|
|
-- 作者:有点蓝 -- 发布时间:2021/11/25 11:57:00 -- 检查代码是不是触发了2次,其它表事件是不是也有设置箱号的代码?
|
|
-- 作者:edisontsui -- 发布时间:2021/11/25 12:53:00 -- 当前一行的箱号为5时,执行上述代码后,分别出现 5、6、6、7 四次警告,最后结果箱号为7。 |
|
-- 作者:edisontsui -- 发布时间:2021/11/25 13:11:00 -- 找到原因了。 |