📄 frmyzlfind.frm
字号:
Else
Call YZLRefMSHFlexGrid(frmYZLGoods, "select goodsid '商品号',goodsname '商品名称',upc '国际码',brand '品牌',typename '商品类型',spec '商品规格',unit '销售单位',store '库存',area '产地' from t_goods where goodsname like ('%" & Trim(txtGoodsName.Text) & "%')")
Unload Me
Exit Sub
End If
End If
If optArea.Value = True Then '根据产地模糊查询
If txtArea.Text = "" Then
MsgBox "请输入查询条件!", vbExclamation
txtArea.SetFocus
Exit Sub
End If
strsql = "select * from t_goods where area like ('%" & Trim(txtArea.Text) & "%')"
Dblink.executeSQL (strsql)
If Dblink.rs.RecordCount = 0 Then
MsgBox "对不起,您所查找的商品不存在,请重新输入!", vbInformation
txtArea.SetFocus
txtArea.SelStart = 0
txtArea.SelLength = 10
Exit Sub
Else
Call YZLRefMSHFlexGrid(frmYZLGoods, "select goodsid '商品号',goodsname '商品名称',upc '国际码',brand '品牌',typename '商品类型',spec '商品规格',unit '销售单位',store '库存',area '产地' from t_goods where area like ('%" & Trim(txtArea.Text) & "%')")
Unload Me
Exit Sub
End If
End If
If txtM1.Text <> "" And txtM2.Text = "" Then '判断库存条件是否完整
MsgBox "请将查询条件写完整!", vbInformation
txtM2.SetFocus
Exit Sub
End If
If txtM1.Text = "" And txtM2.Text <> "" Then '判断库存条件是否完整
MsgBox "请将查询条件写完整!", vbInformation
txtM1.SetFocus
Exit Sub
End If
If txtK1.Text <> "" And txtK2.Text = "" Then '判断卖场条件是否完整
MsgBox "请将查询条件写完整!", vbInformation
txtK2.SetFocus
Exit Sub
End If
If txtK1.Text = "" And txtK2.Text <> "" Then '判断卖场条件是否完整
MsgBox "请将查询条件写完整!", vbInformation
txtK1.SetFocus
Exit Sub
End If
If Val(txtK2.Text) < Val(txtK1.Text) Then '判断范围是否正确
MsgBox "错误,请检查!", vbExclamation
txtK2.SetFocus
txtK2.SelStart = 0
txtK2.SelLength = 10
Exit Sub
End If
If Val(txtM2.Text) < Val(txtM1.Text) Then '判断范围是否正确
MsgBox "错误,请检查!", vbExclamation
txtM2.SetFocus
txtM2.SelStart = 0
txtM2.SelLength = 10
Exit Sub
End If
If txtM2.Text = "" And txtM1.Text = "" Then '如果查询条件只有库存
strsql = "select * from t_goods where store between " & Val(txtK1.Text) & "and " & Val(txtK2.Text) & ""
Dblink.executeSQL (strsql)
If Dblink.rs.RecordCount = 0 Then
MsgBox "您所查询的商品不存在,请重新输入查询条件!", vbInformation
txtK1.Text = ""
txtK2.Text = ""
txtK1.SetFocus
Exit Sub
Else
Call YZLRefMSHFlexGrid(frmYZLGoods, "select goodsid '商品号',goodsname '商品名称',upc '国际码',brand '品牌',typename '商品类型',spec '商品规格',unit '销售单位',store '库存',area '产地' from t_goods where store between " & Val(txtK1.Text) & "and " & Val(txtK2.Text) & "")
Unload Me
Exit Sub
End If
End If
If txtK2.Text = "" And txtK1.Text = "" Then '如果查询条件只有卖场
strsql = "select goodsid from t_market where num between " & Val(txtM1.Text) & "and " & Val(txtM2.Text) & ""
Dblink.executeSQL (strsql)
If Dblink.rs.RecordCount = 0 Then
MsgBox "您所查询的商品不存在,请重新输入查询条件!", vbInformation
txtM1.Text = ""
txtM2.Text = ""
txtM1.SetFocus
Exit Sub
Else
Call YZLRefMSHFlexGrid(frmYZLGoods, "select goodsid '商品号',goodsname '商品名称',upc '国际码',brand '品牌',typename '商品类型',spec '商品规格',unit '销售单位',store '库存',area '产地' from t_goods where goodsid in (select goodsid from t_market where num between " & Val(txtM1.Text) & "and " & Val(txtM2.Text) & ")")
Unload Me
Exit Sub
End If
End If
'两种查询条件都有
strsql = "select * from t_goods where store between " & Val(txtK1.Text) & "and " & Val(txtK2.Text) & " and goodsid in (select goodsid from t_market where num between " & Val(txtM1.Text) & "and " & Val(txtM2.Text) & ")"
Dblink.executeSQL (strsql)
If Dblink.rs.RecordCount = 0 Then
MsgBox "您所查询的商品不存在,请重新输入查询条件!", vbInformation
txtK1.Text = ""
txtK2.Text = ""
txtK1.SetFocus
Exit Sub
Else
Call YZLRefMSHFlexGrid(frmYZLGoods, "select goodsid '商品号',goodsname '商品名称',upc '国际码',brand '品牌',typename '商品类型',spec '商品规格',unit '销售单位',store '库存',area '产地' from t_goods where store between " & Val(txtK1.Text) & "and " & Val(txtK2.Text) & " and goodsid in (select goodsid from t_market where num between " & Val(txtM1.Text) & "and " & Val(txtM2.Text) & ")")
Unload Me
Exit Sub
End If
End Sub
Private Sub Label1_Click()
Option1.Value = True
Call Option1_Click
End Sub
Private Sub Label2_Click()
Option2.Value = True
Call Option2_Click
End Sub
Private Sub Label3_Click()
optID.Value = True
Call optID_Click
End Sub
Private Sub Label4_Click()
optUPC.Value = True
Call optUPC_Click
End Sub
Private Sub Label5_Click()
optGoodsname.Value = True
Call optGoodsname_Click
End Sub
Private Sub Label6_Click()
optArea.Value = True
Call optArea_Click
End Sub
Private Sub optArea_Click()
txtArea.Enabled = True
txtId.Text = ""
txtId.Enabled = False
txtUPC.Text = ""
txtUPC.Enabled = False
txtGoodsName.Text = ""
txtGoodsName.Enabled = False
txtArea.SetFocus
End Sub
Private Sub optGoodsname_Click()
txtGoodsName.Enabled = True
txtId.Text = ""
txtId.Enabled = False
txtUPC.Text = ""
txtUPC.Enabled = False
txtArea.Text = ""
txtArea.Enabled = False
txtGoodsName.SetFocus
End Sub
Private Sub optID_Click()
txtId.Enabled = True
txtUPC.Text = ""
txtUPC.Enabled = False
txtGoodsName.Enabled = False
txtGoodsName.Text = ""
txtArea.Enabled = False
txtArea.Text = ""
txtId.SetFocus
End Sub
Private Sub Option1_Click()
Frame1.Enabled = True
Frame2.Enabled = False
txtK1.Text = ""
txtK2.Text = ""
txtM1.Text = ""
txtM2.Text = ""
txtK1.BackColor = &H8000000F
txtK2.BackColor = &H8000000F
txtM1.BackColor = &H8000000F
txtM2.BackColor = &H8000000F
End Sub
Private Sub Option2_Click()
Frame1.Enabled = False
Frame2.Enabled = True
optID.Value = False
optUPC.Value = False
optGoodsname.Value = False
optArea.Value = False
txtId.Text = ""
txtUPC.Text = ""
txtGoodsName.Text = ""
txtArea.Text = ""
txtId.BackColor = &H8000000F
txtUPC.BackColor = &H8000000F
txtGoodsName.BackColor = &H8000000F
txtArea.BackColor = &H8000000F
End Sub
Private Sub optUPC_Click()
txtUPC.Enabled = True
txtId.Text = ""
txtId.Enabled = False
txtGoodsName.Text = ""
txtGoodsName.Enabled = False
txtArea.Text = ""
txtArea.Enabled = False
txtUPC.SetFocus
End Sub
Private Sub txtArea_GotFocus()
txtId.BackColor = &H8000000F
txtUPC.BackColor = &H8000000F
txtGoodsName.BackColor = &H8000000F
txtArea.BackColor = vbWhite
End Sub
Private Sub txtArea_KeyPress(KeyAscii As Integer)
KeyAscii = YZLKpress(KeyAscii)
End Sub
Private Sub txtGoodsname_GotFocus()
txtId.BackColor = &H8000000F
txtUPC.BackColor = &H8000000F
txtGoodsName.BackColor = vbWhite
txtArea.BackColor = &H8000000F
End Sub
Private Sub txtGoodsName_KeyPress(KeyAscii As Integer)
KeyAscii = YZLKpress(KeyAscii)
End Sub
Private Sub txtID_GotFocus()
txtId.BackColor = vbWhite
txtUPC.BackColor = &H8000000F
txtGoodsName.BackColor = &H8000000F
txtArea.BackColor = &H8000000F
End Sub
Private Sub txtID_KeyPress(KeyAscii As Integer)
If ((KeyAscii > 47 And KeyAscii < 58) Or KeyAscii = 8) Then
Exit Sub
Else
KeyAscii = 0
End If
End Sub
Private Sub txtK1_GotFocus()
txtK1.BackColor = vbWhite
txtK2.BackColor = &H8000000F
txtM1.BackColor = &H8000000F
txtM2.BackColor = &H8000000F
End Sub
Private Sub txtK1_KeyPress(KeyAscii As Integer)
If ((KeyAscii > 47 And KeyAscii < 58) Or KeyAscii = 8) Then
Exit Sub
Else
KeyAscii = 0
End If
End Sub
Private Sub txtK2_GotFocus()
txtK1.BackColor = &H8000000F
txtK2.BackColor = vbWhite
txtM1.BackColor = &H8000000F
txtM2.BackColor = &H8000000F
End Sub
Private Sub txtK2_KeyPress(KeyAscii As Integer)
If ((KeyAscii > 47 And KeyAscii < 58) Or KeyAscii = 8) Then
Exit Sub
Else
KeyAscii = 0
End If
End Sub
Private Sub txtM1_GotFocus()
txtK1.BackColor = &H8000000F
txtK2.BackColor = &H8000000F
txtM1.BackColor = vbWhite
txtM2.BackColor = &H8000000F
End Sub
Private Sub txtM1_KeyPress(KeyAscii As Integer)
If ((KeyAscii > 47 And KeyAscii < 58) Or KeyAscii = 8) Then
Exit Sub
Else
KeyAscii = 0
End If
End Sub
Private Sub txtM2_GotFocus()
txtK1.BackColor = &H8000000F
txtK2.BackColor = &H8000000F
txtM1.BackColor = &H8000000F
txtM2.BackColor = vbWhite
End Sub
Private Sub txtM2_KeyPress(KeyAscii As Integer)
If ((KeyAscii > 47 And KeyAscii < 58) Or KeyAscii = 8) Then
Exit Sub
Else
KeyAscii = 0
End If
End Sub
Private Sub txtUPC_GotFocus()
txtId.BackColor = &H8000000F
txtUPC.BackColor = vbWhite
txtGoodsName.BackColor = &H8000000F
txtArea.BackColor = &H8000000F
End Sub
Private Sub txtUPC_KeyPress(KeyAscii As Integer)
If ((KeyAscii > 47 And KeyAscii < 58) Or KeyAscii = 8) Then
Exit Sub
Else
KeyAscii = 0
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -