以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助] 无法在表中新增记录并直接退出了  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=150549)

--  作者:leoli
--  发布时间:2020/6/1 22:35:00
--  [求助] 无法在表中新增记录并直接退出了
老师,在表属性Datacolchanging中增加以下代码后,克隆记录就不可以,会退出这个Foxtable了,要怎么修改 ? 谢谢。



If e.DataRow("FunitID") = 0 Or e.DataRow("FItemID") = 0 Or e.DataRow("FSupID") = 0 Or  e.DataRow("FCyID") = 0 Or e.DataRow("FPType") = 9 Or e.DataRow("FCurrencyID") = 0 Then
e.DataRow("FUsed") = False   
e.cancel = True
End If

--  作者:有点蓝
--  发布时间:2020/6/1 22:47:00
--  
克隆的时候屏蔽事件:http://www.foxtable.com/webhelp/topics/2218.htm



--  作者:leoli
--  发布时间:2020/6/1 22:58:00
--  
老师,这代码正确吗 ? 怎么插入和复制也不行了 ?
--  作者:有点蓝
--  发布时间:2020/6/1 23:24:00
--  
什么代码?
--  作者:leoli
--  发布时间:2020/6/2 9:17:00
--  
以下这个好像是死循环



If e.DataRow("FunitID") = 0 Or e.DataRow("FItemID") = 0 Or e.DataRow("FSupID") = 0 Or  e.DataRow("FCyID") = 0 Or e.DataRow("FPType") = 9 Or e.DataRow("FCurrencyID") = 0 Then
e.DataRow("FUsed") = False   
e.cancel = True
End If


--  作者:有点蓝
--  发布时间:2020/6/2 9:47:00
--  
这个代码想实现什么目的?
--  作者:leoli
--  发布时间:2020/6/2 10:27:00
--  
如果当前的记录中 :以下任一列的内容是0的话, 就点这个逻辑框 FUsed 无效。

e.DataRow("FunitID") = 0 Or e.DataRow("FItemID") = 0 Or e.DataRow("FSupID") = 0 Or  e.DataRow("FCyID") = 0 Or e.DataRow("FPType") = 9 Or e.DataRow("FCurrencyID") = 0

--  作者:有点蓝
--  发布时间:2020/6/2 10:54:00
--  
就点这个逻辑框 FUsed 无效 -- 什么意思?不能勾选?
--  作者:leoli
--  发布时间:2020/6/2 12:10:00
--  
不要选中它
--  作者:有点蓝
--  发布时间:2020/6/2 13:33:00
--  
代码放到datacolchanged事件

select case e.datacol.name
case "FunitID","FItemID","FSupID","FCyID","FPType","FCurrencyID"
If e.DataRow("FunitID") = 0 Or e.DataRow("FItemID") = 0 Or e.DataRow("FSupID") = 0 Or  e.DataRow("FCyID") = 0 Or e.DataRow("FPType") = 9 Or e.DataRow("FCurrencyID") = 0 Then
e.DataRow("FUsed") = False   
End If
end if