主题:必选参数
Private Sub CmdAdd_Click()
'添加
Dim i As Integer
If Trim(Me.txtNo) <> "" And Trim(Me.txtSum) <> "" Then
Sql = "SELECT * FROM 商品库存表 WHERE 商品编号='" & Me.txtNo & "' "
Set RS = SelectSQL(Sql, msg)
If RS.EOF Then
MsgBox "库中无此商品!"
Else
For i = 1 To Me.ListView1.ListItems.Count
If Me.ListView1.ListItems(i).Text = Trim(Me.txtNo) Then
MsgBox "列表中已有!"
Exit Sub
End If
Next i
Set ltmW = Me.ListView1.ListItems.Add
ltmW.Text = Trim(Me.txtNo)
ltmW.ListSubItems.Add , , RS.Fields(0)
ltmW.ListSubItems.Add , , RS.Fields(3)
ltmW.ListSubItems.Add , , Trim(Me.txtSum)
Me.txtAllValue.Text = Val(Me.txtAllValue.Text) + Val(Trim(Me.txtSum)) * RS.Fields(3)
Me.txtAllValue.Text = Format(Me.txtAllValue.Text, "#.##")
End If
RS.Close
Else
MsgBox "主键不能为空!"
End If
End Sub
88888888888888888888888888888
Sql = "SELECT * FROM 商品库存表 WHERE 商品编号='" & Me.txtNo & "' "这一句的& Me.txtNo 出现必选参数错误