|
本帖最后由 snowing 于 2009-4-15 21:25 编辑
Private Sub Form_Load()
订单号.Value = dd_no
产品号.Value = product_no
客户号.Value = kehu_no
产品数量.Value = product_number
End Sub
----------------------------------------------------------------
Private Sub cmdOK_Click()
'******************************
'修改库存'添加发货记录
'******************************
Dim curdb As Database
Dim curRS As Recordset
Dim strSql As String
Set curRS = curdb.OpenRecordset("select * from 库存表 where 产品号 ='" & 产品号.Value & "'")
If Not curRS.EOF Then
Set curRS = curdb.OpenRecordset("select 库存表 from 库存 where 产品号 = '" & 产品号.Value & "'")
If curRS.Fields("库存量") - product_number >= 0 Then
curdb.Execute "update 库存表 set 库存量 =" & curRS.Fields("库存量") - product_number & " where 产品号 ='" & product_no & "'"
curdb.Execute "update 订货表 set 订单是否发货 ='-1' where 订单号 ='" & dd_no & "'"
strSql = "insert into 发货表 (订单号,发货时间,产品号,客户号,产品数量,发货价格,发货负责人) values ('" & _
订单号.Value & "','" & 发货时间.Value & "','" & 产品号.Value & "','" & _
客户号.Value & "', " & CInt(产品数量.Value) & "," & CInt(发货价格.Value) & ",'" & _
发货负责人.Value & "')"
curdb.Execute (strSql)
MsgBox ("已经发货成功")
DoCmd.Close
Else
MsgBox ("库存不足,不能发货!")
End If
Else: MsgBox ("库存中没有该产品,不能发货!")
End If
End Sub
运行时红体字出现问题!
请好心的高手帮忙一下,毕业设计卡在这里!!!!!谢谢 |
|