老师,我有一个窗口,窗口中有多个Table,我新增了一个检查按钮,想实现检查一下表二的数据在表4中是否存在,使用代码如下:
Dim tx As Table = e.form.Controls("Table2").Table
For Each r As Row In tx
Dim t2 As Table = e.form.Controls("Table4").Table
If t2.Compute("count(id))"," hh = '" & r("cpxh") & "' and mc = '" & r("cpmc") & "' ") = 0 Then
msgbox("产品序号为 '" & r("cpxh") & "' 名称为 '" & r("cpmc") & "' 在清单一级中未能对应,请检查导入的数据行是否正确 ")
Return
End If
Next
但是就是在表二的数据行在表4中存在的情况,但是检测代码也不起作用,请问是哪里的问题?如何处理实现。
hh如果是时间型数据,这里应该这样:
hh = '" & r("cpxh") & "'…… 改为:hh = #" & r("cpxh") & "#……
老师,HH是INT类型,我再加载一下数据看看测试一下,谢谢!
整数不需要单引号:
http://www.foxtable.com/webhelp/topics/1284.htm
If t2.Compute("count(id))"," hh = " & r("cpxh") & " and mc = '" & r("cpmc") & "' ") = 0 Then
另外cpxh和cpmc会不会有空值,有空值这样是查不出来的