比如
If Forms("下采购订单").opened
For Each dr2 As DataRow In DataTables("采购明细表").Select("[采购单号] = '" & Tables("下采购订单_table1").current("采购单号") & "'")
For Each dr As DataRow In DataTables("采购需求").Select(" [_Identify] = '" & dr2("行ID") & "'")
dr.Locked = False '解锁行
dr2("审核") = True
Dim drs = DataTables("采购明细表").Select("[行ID] = '" & dr2("行ID") & "' and [审核] = 'true'")
Dim ids As String = ""
Dim dls As Double = 0
For Each cdr As DataRow In drs
ids &= cdr("采购单号") & ","
dls += cdr("订料数")
Next
dr("订料数")=dls
dr("采购单号") = ids.trim(",")
dr.Locked = True '锁定行
dr2.Locked = True
dr.save()
Next
Next
End If