保存按钮更新了dr的可申领数:
If Forms("领料申请").opened
For Each dr2 As DataRow In DataTables("领料申请明细").Select("[领料申请单号] = '" & Tables("领料申请_table1").current("领料申请单号") & "'")
For Each dr As DataRow In DataTables("物检入库明细表").Select("[物料ID] = '" & dr2("物料ID") & "'")
dr("可申领数") = dr("需求数") - DataTables("领料申请明细").Compute("Sum(申请数)", "[物料ID] = '" & dr2("物料ID") & "' and [审核] = 'true'")
dr.save()
Next
Next
End If
删除按钮代码:(在删除行记录的时候,因为申请数会删掉,当前行对应的物检入库明细表的可申领数也需要更新,代码怎么写?)
If Tables("领料申请_table2").Current IsNot Nothing Then
If Tables("领料申请_table2").TopPosition>-1 Then
For i As Integer=Tables("领料申请_table2").BottomPosition To Tables("领料申请_table2").TopPosition Step -1
Tables("领料申请_table2").Rows(i).Delete()
Next
End If
End If
(领料申请_table2绑定的是领料申请明细表)