📄 frm_boxsignfind.frm
字号:
VERSION 5.00
Begin VB.Form Frm_BoxSignFind
BorderStyle = 1 'Fixed Single
Caption = "箱唛查询"
ClientHeight = 4980
ClientLeft = 45
ClientTop = 330
ClientWidth = 8055
Icon = "Frm_BoxSignFind.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4980
ScaleWidth = 8055
StartUpPosition = 3 '窗口缺省
Begin VB.Frame Frame1
Height = 4935
Left = 0
TabIndex = 0
Top = 0
Width = 8055
Begin VB.CommandButton Cmd_Add
Caption = "添加(A&dd)"
Height = 375
Left = 2535
TabIndex = 10
Top = 1080
Width = 1215
End
Begin VB.CommandButton Cmd_Clear
Caption = "清除(&Clear)"
Height = 375
Left = 6540
TabIndex = 9
Top = 1080
Width = 1215
End
Begin VB.CommandButton Cmd_Or
Caption = "或者(&Or)"
Height = 375
Left = 5175
TabIndex = 8
Top = 1080
Width = 1215
End
Begin VB.CommandButton Cmd_And
Caption = "并且(&And)"
Height = 375
Left = 3855
TabIndex = 7
Top = 1080
Width = 1215
End
Begin VB.TextBox Txt_ConditionAll
ForeColor = &H00FF0000&
Height = 2295
Left = 255
Locked = -1 'True
MultiLine = -1 'True
TabIndex = 6
Text = "Frm_BoxSignFind.frx":0CCA
Top = 1920
Width = 7560
End
Begin VB.ComboBox Cob_Amount_like
Height = 300
Left = 2655
Style = 2 'Dropdown List
TabIndex = 5
Top = 600
Width = 1200
End
Begin VB.TextBox Txt_Condition
Height = 300
Left = 3975
TabIndex = 4
Text = "Text1"
Top = 600
Width = 3840
End
Begin VB.ComboBox Cob_Fields
Height = 300
Left = 255
Style = 2 'Dropdown List
TabIndex = 3
Top = 600
Width = 2295
End
Begin VB.CommandButton Cmd_Exit
Caption = "退出(&X)"
Height = 375
Left = 4320
TabIndex = 2
Top = 4320
Width = 1215
End
Begin VB.CommandButton Cmd_Find
Caption = "查询(&F)"
Height = 375
Left = 2640
TabIndex = 1
Top = 4320
Width = 1215
End
Begin VB.Line Line1
BorderColor = &H00C0FFFF&
X1 = 240
X2 = 7800
Y1 = 1560
Y2 = 1560
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "条件值"
Height = 180
Left = 3975
TabIndex = 14
Top = 360
Width = 540
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "查询规则"
Height = 180
Left = 2655
TabIndex = 13
Top = 360
Width = 720
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "查询总条件"
Height = 180
Left = 255
TabIndex = 12
Top = 1680
Width = 900
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "选择查询字段"
Height = 180
Left = 255
TabIndex = 11
Top = 360
Width = 1080
End
End
End
Attribute VB_Name = "Frm_BoxSignFind"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmd_Add_Click()
On Error GoTo err
If Me.Cob_Amount_like.text = "like" Then
Me.Txt_ConditionAll.text = Me.Cob_Fields.text & " like '%'+'" & Me.Txt_Condition.text & "'+'%' "
Else
Me.Txt_ConditionAll.text = Me.Cob_Fields.text & " = '" & Me.Txt_Condition.text & "'"
End If
Me.Cmd_Add.Enabled = False
Me.Cmd_And.Enabled = True
Me.Cmd_Or.Enabled = True
Exit Sub
err:
MsgBox err.Description, vbCritical
End Sub
Private Sub Cmd_And_Click()
On Error GoTo err
If Me.Cob_Amount_like.text = "like" Then
Me.Txt_ConditionAll.text = Me.Txt_ConditionAll.text & " And " & Me.Cob_Fields.text & " like '%'+'" & Me.Txt_Condition.text & "'+'%' "
Else
Me.Txt_ConditionAll.text = Me.Txt_ConditionAll.text & " And " & Me.Cob_Fields.text & " = '" & Me.Txt_Condition.text & "'"
End If
Exit Sub
err:
MsgBox err.Description, vbCritical
End Sub
Private Sub Cmd_Clear_Click()
On Error GoTo err
Me.Txt_ConditionAll.text = ""
Me.Cmd_Add.Enabled = True
Me.Cmd_And.Enabled = False
Me.Cmd_Or.Enabled = False
Exit Sub
err:
MsgBox err.Description, vbCritical
End Sub
Private Sub cmd_Exit_Click()
On Error Resume Next
Unload Me
End Sub
Private Sub Cmd_Find_Click()
On Error GoTo err
If Me.Txt_ConditionAll.text = "" Then
MsgBox "查询条件为空!" + Chr(13) + "请输入后再查询!", vbInformation, "提示信息"
Exit Sub
End If
Rs_BoxSign.Close
Rs_BoxSign.Open "select * from BoxSign where " & Me.Txt_ConditionAll.text, Cn_BoxSign, adOpenKeyset, adLockOptimistic, adCmdText
If Rs_BoxSign.RecordCount <> 0 Then
' If Rs_BoxSign.RecordCount <> 0 Then Rs_BoxSign.MoveLast
Rs_BoxSign.MoveLast
Set Frm_WholeBoxSign.tdbg_BoxSign.DataSource = Rs_BoxSign
' Call Frm_WholeBoxSign.TDBGrid_Width_Set
Unload Me
Exit Sub
Else
Rs_BoxSign.Close
Rs_BoxSign.Open "select * from BoxSign", Cn_BoxSign, adOpenKeyset, adLockOptimistic, adCmdText
If Rs_BoxSign.RecordCount <> 0 Then Rs_BoxSign.MoveLast
Set Frm_WholeBoxSign.tdbg_BoxSign.DataSource = Rs_BoxSign
' Call Frm_WholeBoxSign.TDBGrid_Width_Set
MsgBox "找不到此记录!", vbInformation, "提示信息"
Me.Txt_ConditionAll.text = ""
Me.Cmd_Add.Enabled = True
Me.Cmd_And.Enabled = False
Me.Cmd_Or.Enabled = False
Exit Sub
End If
Exit Sub
err:
MsgBox err.Description, vbCritical
End Sub
Private Sub Cmd_Or_Click()
On Error GoTo err
If Me.Cob_Amount_like.text = "like" Then
Me.Txt_ConditionAll.text = Me.Txt_ConditionAll.text & " Or " & Me.Cob_Fields.text & " like '%'+'" & Me.Txt_Condition.text & "'+'%'"
Else
Me.Txt_ConditionAll.text = Me.Txt_ConditionAll.text & " Or " & Me.Cob_Fields.text & " = '" & Me.Txt_Condition.text & "'"
End If
Exit Sub
err:
MsgBox err.Description, vbCritical
End Sub
Private Sub Form_Load()
On Error GoTo err
Me.Cob_Amount_like.AddItem ("like")
Me.Cob_Amount_like.AddItem ("=")
Me.Cob_Amount_like.text = "like"
Me.Cob_Fields.AddItem ("规格单号")
Me.Cob_Fields.AddItem ("小号")
Me.Cob_Fields.AddItem ("客户名称")
Me.Cob_Fields.AddItem ("采购单号")
Me.Cob_Fields.AddItem ("料号")
Me.Cob_Fields.AddItem ("节目名称")
Me.Cob_Fields.AddItem ("订货数量")
Me.Cob_Fields.AddItem ("每箱片数")
Me.Cob_Fields.AddItem ("本箱片数")
Me.Cob_Fields.AddItem ("箱号")
Me.Cob_Fields.AddItem ("防尘垫片数")
Me.Cob_Fields.AddItem ("QC检查者")
Me.Cob_Fields.AddItem ("包装日期和班次")
Me.Cob_Fields.text = "规格单号"
Me.Txt_Condition.text = ""
Me.Txt_ConditionAll.text = ""
Me.Cmd_Add.Enabled = True
Me.Cmd_And.Enabled = False
Me.Cmd_Or.Enabled = False
Exit Sub
err:
MsgBox err.Description, vbCritical
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -