以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- [求助]for each语句 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=150219) |
-- 作者:l1q2lq -- 发布时间:2020/5/24 10:47:00 -- [求助]for each语句 老师 有一段代码如下 想实现如果库存表中有只要一行缺货,就无法出库 但是实际效果是:如果001有货,002缺货,003有货,就会把001出库,002,003停止执行代码 需要怎么修改 For Each r1 As Row In Tables("库存表") If r1("库存状态") = "缺货" Then MessageBox.Show("库存不足!") Exit For Else Dim r2 As Row = Tables("出库表").AddNew r2("零件号") = r1("零件号") r2("出库数量") = r1("发货数量") Next |
-- 作者:DataWorker -- 发布时间:2020/5/24 11:16:00 -- Dim i As Integer = 0 For Each r1 As Row In Tables("库存表") If r1("库存状态") = "缺货" Then i = i + 1 End If Next If i = 0 Then For Each r1 As Row In Tables("库存表") Dim r2 As Row = Tables("出库表").AddNew r2("零件号") = r1("零件号") r2("出库数量") = r1("发货数量") Next Else MessageBox.Show("库存不足!") End If
|
-- 作者:有点蓝 -- 发布时间:2020/5/24 21:46:00 -- If Tables("库存表").Compute("count(库存状态)","库存状态=\'缺货\'") > 0 then MessageBox.Show("库存不足!") else For Each r1 As Row In Tables("库存表") Dim r2 As Row = Tables("出库表").AddNew r2("零件号") = r1("零件号") r2("出库数量") = r1("发货数量") Next endif
|