; For j = 1 To flex1.Cols - 1
flex1.TextMatrix(i, j) = ""
Next j
Next i
txt1(0) = ""
txt1(1) = ""
txt1(0).SetFocus
view_DP
End Sub
Private Sub cmdSave_Click()
Dim js As Integer
For i = 1 To flex1.Rows - 1
If flex1.TextMatrix(i, 1) <> "" And flex1.TextMatrix(i, 2) <> "" And flex1.TextMatrix(i, 4) = "" Then
MsgBox "第" & i & "行录入错误!", , "提示窗口"
Exit Sub
End If
If flex1.TextMatrix(i, 1) = "" Then
js = js + 1
End If
Next i
If js = flex1.Rows - 1 Then
MsgBox "没有要保存的数据!", , "提示窗口"
Exit Sub
End If
rs1.Open "select * from 入库从表", Cnn, adOpenKeyset, adLockOptimistic
For i = 1 To flex1.Rows - 1
If flex1.TextMatrix(i, 1) <> "" And flex1.TextMatrix(i, 2) <> "" And flex1.TextMatrix(i, 4) <> "" Then
''添加新记录到"入库从表"中
rs1.AddNew
If flex1.TextMatrix(i, 1) <> "" Then rs1.Fields("商品名称") = flex1.TextMatrix(i, 1)
If flex1.TextMatrix(i, 2) <> "" Then rs1.Fields("规格") = flex1.TextMatrix(i, 2)
If flex1.TextMatrix(i, 3) <> "" Then rs1.Fields("单位") = flex1.TextMatrix(i, 3)
rs1.Fields("入库数量") = Val(flex1.TextMatrix(i, 4))
rs1.Fields("单价") = Val(flex1.TextMatrix(i, 5))
rs1.Fields("金额") = Val(flex1.TextMatrix(i, 6))
If flex1.TextMatrix(i, 7) <