|
本帖最后由 zyz218 于 2011-4-14 22:43 编辑
'更新在库状况
Dim ym As String
DoCmd.SetWarnings False
ym = Format(Me.indate, "yyyy-mm")
If IsNull(DLookup("onqty", "stock", "yearmonth='" & ym & "'and codeno='" & Me.codeno & "'and area='" & Me.area & "'")) Then
STemp = "INSERT INTO stock"
STemp = STemp & "(yearmonth,codeno,inqty,onqty,area,distri)"
STemp = STemp & " VALUES ('" & ym & "','" & Me.codeno & "',"
STemp = STemp & "'" & Me.inqty & "','" & Me.inqty & "','" & Me.area & "','" & Me.inqty & "')"
DoCmd.RunSQL STemp
Else
STemp = "update stock set inqty=inqty+" & Me.inqty & ",onqty=onqty+" & Me.inqty & " "
STemp = STemp & "where yearmonth='" & ym & "'and codeno='" & Me.codeno & "'and area='" & Me.area & "'"
DoCmd.RunSQL STemp
End If
本月这个图番所在库区没有则新增一行,有则更新入库数与在库数,这样处理
|
|