en
DataGrid2.Visible = True
DataGrid2.SetFocus
Else
MsgBox "无可选的商品信息,请首先录入商品数据!", , "提示窗口"
End If
End If
End If
''只有TextBox控件在“数量”单元格时,才使用以下过程
If flex1.Col >= 4 Then
EditKeyCode flex1, txtEdit, KeyCode, Shift
End If
End Sub
''当输入数据并按下 ENTER 键,或用鼠标单击MSHFlexGrid 控件中的另一个单元时,
''焦点将返回此控件。这时 TextBox 中的文本被复制到活动单元中
Private Sub flex1_GotFocus()
If txtEdit.Visible = False Then Exit Sub
flex1 = txtEdit
txtEdit.Visible = False
view_DP
End Sub
Private Sub flex1_LeaveCell()
If txtEdit.Visible = False Then Exit Sub
flex1 = txtEdit
txtEdit.Visible = False
End Sub
Private Sub cmdCancel_Click()
For i = 1 To flex1.Rows - 1
For j = 1 To flex1.Cols - 1
flex1.TextMatrix(i, j) = ""
Next j
Next i
SetButtons False
txtEdit.Visible = False
view_DP
End Sub
Private Sub cmdRegister_Click()
Dim lsph As Integer ''声明一个整型变量
''创建入库票号
rs1.Open "select * from 入库主表 order by 票号", Cnn, adOpenStatic
If rs1.RecordCount > 0 Then
If Not rs1.EOF Then rs1.MoveLast
If rs1.Fields("票号") <> "" Then
lsph = Val(Right(Trim(rs1.Fields("票号")), 4)) + 1
txtph.Text = Date & "rk" & Format(lsph, "0000")
End If
Else
txtph.Text = Date & "rk" & "0001"
End If
rs1.Close
txtDate.Text = Date
''设置控件有效或无效
SetButtons True
For i = 1 To flex1.Rows - 1