|
修改:
Private Sub CmdSave_Click()
Dim x#, x0#, x1#
Dim curdb As ADODB.Connection
Dim rec As New ADODB.Recordset
Dim i As Integer
Dim Sdate As Date
Sdate = Date
Set curdb = CurrentProject.Connection
'If mDAOTransForm.SaveAll Then
rec.Open "select DISTINCT 物料编号 from 入库单明细 where 入库单ID='" & Me.Form.入库单ID & "'", CurrentProject.Connection, adOpenKeyset, adLockOptimistic, adCmdTableDirect
For i = 1 To rec.RecordCount
'逐个更新不同物料编码的库存数量
x = DSum("入库数量", "入库单明细", "入库单ID='" & Me.Form.入库单ID & "' and 物料编号 ='" & rec.Fields(0) & "'")
curdb.Execute "update 库存 set 原有库存=" & x0 & ",现有库存=" & x0 + x & ",库存变动=" & x & ",库存变动日期=#" & Sdate & "# where 物料编号='" & rec.Fields(0) & "'"
rec.MoveNext
Next i
'End If
End Sub
可以通过,If mDAOTransForm.SaveAll Then的判断功能就没有了 |
|