当前位置:编程学习 > VB >>

请教高手:进货销售库存 商品数量关系的代码

点击进货保存按钮 进货数量加到库存里 
Private Sub Saves()
   If Text1(0).Text = "" Or Text1(1).Text = "" Or Text1(2).Text = "" Or Text1(3).Text = "" Or Text1(4).Text = "" Then
      MsgBox "重要信息不能为空值", 48, "提示信息"
  Else
       AdoRs.Open "select * from 配件进货 where 进货单号='" + Text1(0).Text + "'", Cnn, adOpenKeyset
         If AdoRs.RecordCount > 0 Then
              MsgBox "该配件进货信息已经存在", 48, "提示信息"
              AdoRs.Close
         Else
              AdoRs.Close
            c = MsgBox("确认保存信息吗", 33, "提示信息")
              If c = vbOK Then
                Set AdoRs = Cnn.Execute("insert into 配件进货 values('" & Text1(0) _
                & "','" & Str(DT1.Value) & "','" & Text1(1) & "','" & Text1(2) & "','" & Text1(3) & "','" _
                & Text1(4) & "','" & Text1(5) & "','" & Text1(6) & "','" & Text1(7) & "','" & Text1(8) & "','" & Text1(9) & "','" & Text1(10) & "','" & Text1(11) & "','" & Text1(12) & "','" & Text1(13) & "')")
                MsgBox "数据保存成功", 64, "提示信息"
                Call RefreshData
            Else
            End If
         End If
  End If
       AdoRs1.Open "select * from 配件库存 where 配件编号='" + Text1(5).Text + "'", Cnn, adOpenKeyset
         If AdoRs1.RecordCount > 0 Then
         Str1 = Val(AdoRs1.Fields("数量"))
         Str1 = Str1 + Val(Text1(10).Text)

          Set AdoRs1 = Cnn.Execute("UPDATE 配件库存 SET 数量='" + Str1 + "' where 配件编号='" + Text1(5).Text + "'")
  End If
  AdoRs1.Close
End Sub --------------------编程问答-------------------- 你想问什么  详细一点~ --------------------编程问答-------------------- 你要问神马? --------------------编程问答-------------------- 神马说,不知道…… --------------------编程问答--------------------
引用 3 楼 yiguangqiang88 的回复:
神马说,不知道……


"不"说:我怎么可能知道。 --------------------编程问答-------------------- 请大婶删贴
补充:VB ,  基础类
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,