以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 主表新增多条记录与子表同步保存问题 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=175412) |
|
-- 作者:125651911 -- 发布时间:2022/3/3 15:34:00 -- 主表新增多条记录与子表同步保存问题 保存按钮: Dim i_cgdh As Integer = Tables("采购主表").Current("采购单号") If DataTables("采购明细表").Find("采购单号 = " & i_cgdh ) Is Nothing Then MessageBox.Show("请添加采购明细!") Else If DataTables("采购明细表").Find("采购单号 = " & i_cgdh & " And (isnull(数量,0) = 0 or isnull(单价,0) = 0) ") Is Nothing Then Tables("采购主表").Save() Tables("采购主表.采购明细表").Save() Else MessageBox.Show("明细表数量或单价不可为0!") End If End If 这样只能判断与当前主表行相同单号的子表,当主表一次新增多笔同时保存,怎样判断? |
|
-- 作者:有点蓝 -- 发布时间:2022/3/3 15:43:00 -- for each r as row in Tables("采购主表").rows Dim i_cgdh As Integer = r("采购单号") If DataTables("采购明细表").Find("采购单号 = " & i_cgdh ) Is Nothing Then MessageBox.Show( i_cgdh & "采购单号请添加采购明细!") return Else If DataTables("采购明细表").Find("采购单号 = " & i_cgdh & " And (isnull(数量,0) = 0 or isnull(单价,0) = 0) ") Is Nothing Then Else MessageBox.Show("明细表数量或单价不可为0!") return End If End If next Tables("采购主表").Save() Tables("采购明细表").Save() |
|
-- 作者:125651911 -- 发布时间:2022/3/3 16:38:00 --
|
|
-- 作者:有点蓝 -- 发布时间:2022/3/3 16:50:00 -- 参考:http://www.foxtable.com/webhelp/topics/0428.htm |
|
-- 作者:125651911 -- 发布时间:2022/3/3 16:53:00 -- ![]() |