|
源程序如下:(我要If rst("数量") < rst("已交数" 这一句:我要rst("数量")和rst("已交数")总数进行比较,怎样写啊)
Dim db As DAO.Database
Dim rs As DAO.Recordset, rst As DAO.Recordset
Dim n As Integer, str As String
n = 0
Set db = CurrentDb
Set rs = db.OpenRecordset(str1)
If rs.RecordCount <> 0 Then
rs.MoveFirst
While Not rs.EOF
Set rst = db.OpenRecordset(str2)
If rs.RecordCount <> 0 Then
rst.MoveFirst
While Not rst.EOF
If rst(1) = rs(1) Then
rst.Edit
If j = 0 Then
rst(4) = rst(4) + rs(3)
Else
rst(4) = rst(4) - rs(3)
End If
rst.Update
End If
If rst("数量") < rst("已交数") Then
n = 1
End If
rst.MoveNext
Wend
End If
str = " select * from 分仓库存 where 仓库 = '" & rs(2) & "' and 产品编号 = '" & rs(1) & "' "
Set rst = db.OpenRecordset(str)
If rst.RecordCount <> 0 Then
rst.Edit
If i = 0 Then
rst(2) = rst(2) - rs(3)
Else
rst(2) = rst(2) + rs(3)
End If
rst.Update
Else
rst.AddNew
rst(0) = rs(2)
rst(1) = rs(1)
If i = 0 Then
rst(2) = 0 - rs(3)
Else
rst(2) = rs(3)
End If
rst.Update
End If
rs.MoveNext
Wend
Set rst = db.OpenRecordset(str3)
rst.Edit
If n = 1 Then
rst("结案") = False
Else
rst("结案") = True
End If
rst.Update
End If |
|