📄 frmqstorage.frm
字号:
End If
intindex = intindex + 1
rct.MoveNext
Else
rct.MoveNext
End If
Case "20.01--100.00"
If rct.Fields.Item(3).Value > 20.01 And rct.Fields.Item(3).Value <= 100 Then
If flexView() = True Then
End If
intindex = intindex + 1
rct.MoveNext
Else
rct.MoveNext
End If
Case ">100"
If rct.Fields.Item(3).Value > 100 Then
If flexView() = True Then
End If
intindex = intindex + 1
rct.MoveNext
Else
rct.MoveNext
End If
End Select
Loop
If intindex = 0 Then
MsgBox "无符合查询条件的记录,请重新查询!", vbInformation + vbOKOnly, "查询提示!"
rct.MoveFirst
Exit Sub
Else
MsgBox "共有" & intindex & "条符合查询条件的记录!", vbInformation + vbOKOnly, "查询提示!"
End If
ElseIf OptSPID.Value = True Then
If TxtSPID.Text <> "" Then
Do While Not rct.EOF
If rct.Fields.Item(5).Value Like "*" & TxtSPID.Text & "*" Then
If flexView() = True Then
End If
intindex = intindex + 1
rct.MoveNext
Else
rct.MoveNext
End If
Loop
If intindex > 0 Then
MsgBox "共有" & intindex & "条符合查询条件的记录!", vbInformation + vbOKOnly, "查询提示!"
Else
MsgBox "无符合查询条件的记录,请重新查询!", vbInformation + vbOKOnly, "查询提示!"
rct.MoveFirst
Call CmdINT_Click
Exit Sub
End If
Else
MsgBox "厂商编号不能为空,请重输!", vbInformation + vbOKOnly, "查询提示!"
Exit Sub
End If
End If
CmdModify.Enabled = True
CmdAdd.Enabled = True
Dim str1 As String
str1 = "select * from employee "
Set rct1 = QueryXFInfo(str1)
rct1.MoveFirst
Do While Not rct1.EOF
If Trim(rct1.Fields.Item(1).Value) = strName Then
If rct1.Fields.Item(3).Value = "User" Then '判断用户的权限,普通用户不能清空或删除记录
CmdDel.Enabled = False
Exit Do
Else
CmdDel.Enabled = True
Exit Do
End If
Else
rct1.MoveNext
End If
Loop
rct.MoveFirst
CmdQuery.Enabled = False
End Sub
Private Sub Form_Load()
Dim str As String
str = "select * from storage"
Set rct = QueryXFInfo(str)
CmdDel.Enabled = False
CmdModify.Enabled = False
OptAmount.Value = True
Comb1.Text = Comb1.List(0)
Call PreView
End Sub
'声明初始化时表格显示函数
Private Sub PreView()
Dim intindex As Integer
MSFlexGrid1.ColWidth(0) = 12 * 25 * 3
MSFlexGrid1.ColWidth(1) = 12 * 25 * 5
MSFlexGrid1.ColWidth(2) = 12 * 25 * 6
MSFlexGrid1.ColWidth(3) = 12 * 25 * 5
MSFlexGrid1.ColWidth(4) = 12 * 25 * 5
MSFlexGrid1.ColWidth(5) = 12 * 25 * 4
MSFlexGrid1.ColWidth(6) = 12 * 25 * 5
MSFlexGrid1.Row = 0
For intindex = 0 To 6 '固定行显示格式,字体格式
MSFlexGrid1.Col = intindex
MSFlexGrid1.CellAlignment = 4
MSFlexGrid1.CellFontBold = True
Next intindex
MSFlexGrid1.TextMatrix(0, 0) = "序号"
MSFlexGrid1.TextMatrix(0, 1) = "商品编号"
MSFlexGrid1.TextMatrix(0, 2) = "商品名称"
MSFlexGrid1.TextMatrix(0, 3) = "销售单价"
MSFlexGrid1.TextMatrix(0, 4) = "库存数量"
MSFlexGrid1.TextMatrix(0, 5) = "单位量"
MSFlexGrid1.TextMatrix(0, 6) = "厂商编号"
End Sub
Private Sub OptID_Click()
TxtID.SetFocus
End Sub
Private Sub OptName_Click()
TxtName.SetFocus
End Sub
Private Sub OptSPID_Click()
TxtSPID.SetFocus
End Sub
'声明查询函数
Public Function flexView() As Boolean
Dim intindex As Integer
MSFlexGrid1.Row = MSFlexGrid1.Rows - 1
For intindex = 0 To 6
MSFlexGrid1.Col = intindex
MSFlexGrid1.CellAlignment = 4
Next intindex
id = id + 1
MSFlexGrid1.Col = 0
MSFlexGrid1.Text = id
MSFlexGrid1.Col = 1
MSFlexGrid1.Text = rct.Fields.Item(0).Value
MSFlexGrid1.Col = 2
MSFlexGrid1.Text = rct.Fields.Item(1).Value
MSFlexGrid1.Col = 3
If Val(rct.Fields.Item(2).Value) < 1 Then '如果数字类型常量的值小于1,在小数点前补0
MSFlexGrid1.Text = "0" & rct.Fields.Item(2).Value
Else
MSFlexGrid1.Text = rct.Fields.Item(2).Value
End If
MSFlexGrid1.Col = 4
MSFlexGrid1.Text = rct.Fields.Item(3).Value
MSFlexGrid1.Col = 5
MSFlexGrid1.Text = rct.Fields.Item(4).Value
MSFlexGrid1.Col = 6
MSFlexGrid1.Text = rct.Fields.Item(5).Value
MSFlexGrid1.AddItem (Empty)
End Function
Private Sub txtID_LostFocus()
If IsNumber(TxtID.Text) = False Then
MsgBox "商品编号输入不合法!", vbInformation + vbOKOnly, "输入提示!"
TxtID.Text = ""
TxtID.SetFocus
Exit Sub
End If
End Sub
'判断文本框输入的合法性
Private Sub TxtName_LostFocus()
If IsChar(TxtName.Text) = False Then
MsgBox "商品名称输入不合法!", vbInformation + vbOKOnly, "输入提示!"
TxtName.Text = ""
TxtName.SetFocus
Exit Sub
End If
End Sub
Private Sub TxtSPID_LostFocus()
If IsChar(TxtSPID.Text) = False Then
MsgBox "厂商编号输入不合法!", vbInformation + vbOKOnly, "输入提示!"
TxtSPID.Text = ""
TxtSPID.SetFocus
Exit Sub
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -