multifindform.frm
来自「一套VB完整的灯具销售管理系统设计」· FRM 代码 · 共 482 行
FRM
482 行
VERSION 5.00
Begin VB.Form MultiFindForm
BackColor = &H00808000&
BorderStyle = 3 'Fixed Dialog
Caption = "发票单项、多项查询系统"
ClientHeight = 4965
ClientLeft = 45
ClientTop = 330
ClientWidth = 5925
Icon = "MultiFindForm.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4965
ScaleWidth = 5925
ShowInTaskbar = 0 'False
StartUpPosition = 3 'Windows Default
Begin VB.OptionButton Option2
BackColor = &H00808000&
Caption = "或"
ForeColor = &H0000C0C0&
Height = 225
Left = 5070
TabIndex = 21
Top = 2760
Width = 480
End
Begin VB.TextBox Text3
Enabled = 0 'False
Height = 435
Left = 105
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 20
Top = 4410
Width = 5700
End
Begin VB.OptionButton Option1
BackColor = &H00808000&
Caption = "和"
ForeColor = &H0000C0C0&
Height = 180
Left = 4395
TabIndex = 19
Top = 2782
Value = -1 'True
Width = 480
End
Begin VB.CommandButton SingalFind
Caption = "单项查询"
Height = 405
Left = 4395
TabIndex = 18
Top = 3705
Width = 1230
End
Begin VB.CommandButton AddIf
Caption = "添加条件"
Enabled = 0 'False
Height = 420
Left = 4410
TabIndex = 17
Top = 3255
Width = 1200
End
Begin VB.Frame Frame2
BackColor = &H00808000&
Caption = "多项查询"
ForeColor = &H000000C0&
Height = 1665
Left = 315
TabIndex = 10
Top = 2505
Width = 3615
Begin VB.TextBox Text2
Height = 300
Left = 1380
TabIndex = 16
Top = 1200
Width = 1890
End
Begin VB.ComboBox Combo4
Height = 300
Left = 1380
Style = 2 'Dropdown List
TabIndex = 15
Top = 780
Width = 1890
End
Begin VB.ComboBox Combo3
Height = 300
Left = 1380
Style = 2 'Dropdown List
TabIndex = 14
Top = 315
Width = 1890
End
Begin VB.Label Label3
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "请输入值"
Height = 180
Index = 1
Left = 540
TabIndex = 13
Top = 1230
Width = 720
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "操作符"
Height = 180
Index = 1
Left = 720
TabIndex = 12
Top = 810
Width = 540
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "请选择项目"
Height = 180
Index = 1
Left = 360
TabIndex = 11
Top = 330
Width = 900
End
End
Begin VB.CommandButton CloseForm
Cancel = -1 'True
Caption = "退出(&X)"
Height = 435
Left = 4335
TabIndex = 9
Top = 1530
Width = 1215
End
Begin VB.CommandButton MultiSure
Caption = "多项查询"
Height = 435
Left = 4335
TabIndex = 8
Top = 1020
Width = 1215
End
Begin VB.CommandButton Sure
Caption = "开始查找"
Enabled = 0 'False
Height = 435
Left = 4335
TabIndex = 7
Top = 510
Width = 1215
End
Begin VB.Frame Frame1
BackColor = &H00808000&
Caption = "单项查询"
ForeColor = &H00800080&
Height = 1785
Left = 360
TabIndex = 3
Top = 255
Width = 3525
Begin VB.TextBox Text1
Height = 270
Left = 1320
TabIndex = 2
Top = 1260
Width = 1890
End
Begin VB.ComboBox Combo2
Height = 300
Left = 1320
Style = 2 'Dropdown List
TabIndex = 1
Top = 795
Width = 1875
End
Begin VB.ComboBox Combo1
Height = 300
Left = 1320
Style = 2 'Dropdown List
TabIndex = 0
Top = 345
Width = 1875
End
Begin VB.Label Label3
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "请输入值"
ForeColor = &H0000FFFF&
Height = 180
Index = 0
Left = 495
TabIndex = 6
Top = 1290
Width = 720
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "操作符"
ForeColor = &H0000FFFF&
Height = 180
Index = 0
Left = 675
TabIndex = 5
Top = 870
Width = 540
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "请选择项目"
ForeColor = &H0000FFFF&
Height = 180
Index = 0
Left = 315
TabIndex = 4
Top = 390
Width = 900
End
End
Begin VB.Line Line2
BorderColor = &H00FFFFFF&
X1 = 45
X2 = 5895
Y1 = 2295
Y2 = 2295
End
Begin VB.Line Line1
X1 = 60
X2 = 5880
Y1 = 2370
Y2 = 2370
End
End
Attribute VB_Name = "MultiFindForm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim compareStr As String, FindStr As String
Private Sub Addif_Click()
Select Case Combo4.Text
Case "等于"
compareStr = "="
Case "大于"
compareStr = ">"
Case "小于"
compareStr = "<"
Case "大于等于"
compareStr = ">="
Case "小于等于"
compareStr = "<="
Case Else
compareStr = " Like "
End Select
Select Case Combo3.Text
Case "数量", "单价", "金额", "合计", "欠款", "实付款"
FindStr = Combo3.Text & compareStr & Val(Trim(Text2.Text))
Case "日期"
FindStr = Combo3.Text & compareStr & "#" & Trim(Text2.Text) & "#"
Case Else
If Combo4.Text = "等于" Then
FindStr = Combo3.Text & compareStr & "'" & Trim(Text2.Text) & "'"
Else
FindStr = Combo3.Text & compareStr & "'*" & Trim(Text2.Text) & "*'"
End If
End Select
If Trim(Text3.Text) = "" Then
Text3.Text = FindStr
Else
If Option1.Value = True Then
Text3.Text = Text3.Text & " AND " & FindStr
Else
Text3.Text = Text3.Text & " OR " & FindStr
End If
End If
End Sub
Private Sub CloseForm_Click()
Unload Me
End Sub
Private Sub Combo1_Click()
Combo2.Clear
Text1.Text = ""
Select Case Combo1.Text
Case "数量", "单价", "金额", "合计", "欠款", "实付款", "日期"
Combo2.AddItem "等于", 0
Combo2.AddItem "大于", 1
Combo2.AddItem "小于", 2
Combo2.AddItem "大于等于", 3
Combo2.AddItem "小于等于", 4
Combo2.ListIndex = 0
Case Else
Combo2.AddItem "等于", 0
Combo2.AddItem "包含", 1
Combo2.ListIndex = 0
End Select
End Sub
Private Sub Combo3_Click()
Combo4.Clear
Text2.Text = ""
Select Case Combo3.Text
Case "数量", "单价", "金额", "合计", "欠款", "实付款", "日期"
Combo4.AddItem "等于", 0
Combo4.AddItem "大于", 1
Combo4.AddItem "小于", 2
Combo4.AddItem "大于等于", 3
Combo4.AddItem "小于等于", 4
Combo4.ListIndex = 0
Case Else
Combo4.AddItem "等于", 0
Combo4.AddItem "包含", 1
Combo4.ListIndex = 0
End Select
End Sub
Private Sub Form_Load()
MultiFindForm.Left = (Screen.Width - MultiFindForm.Width) / 2
MultiFindForm.Top = (Screen.Height - MultiFindForm.Height) / 4
MultiFindForm.Height = 2715
Combo1.AddItem "发票号", 0
Combo1.AddItem "经手人", 1
Combo1.AddItem "品名", 2
Combo1.AddItem "单价", 3
Combo1.AddItem "数量", 4
Combo1.AddItem "金额", 5
Combo1.AddItem "合计", 6
Combo1.AddItem "购货人", 7
Combo1.AddItem "日期", 8
Combo1.AddItem "实付款", 9
Combo1.AddItem "欠款", 10
Combo1.ListIndex = 0
Combo3.AddItem "发票号", 0
Combo3.AddItem "经手人", 1
Combo3.AddItem "品名", 2
Combo3.AddItem "单价", 3
Combo3.AddItem "数量", 4
Combo3.AddItem "金额", 5
Combo3.AddItem "合计", 6
Combo3.AddItem "购货人", 7
Combo3.AddItem "日期", 8
Combo3.AddItem "实付款", 9
Combo3.AddItem "欠款", 10
Combo3.ListIndex = 0
End Sub
Sub MultiSure_Click()
MultiSure.Enabled = False
MultiFindForm.Height = 5415
End Sub
Private Sub SingalFind_Click()
MultiFindForm.Height = 2715
MultiSure.Enabled = True
End Sub
Private Sub Sure_Click()
If Trim(Text3.Text) = "" Then
'单项查询
Select Case Combo2.Text
Case "等于"
compareStr = "="
Case "大于"
compareStr = ">"
Case "小于"
compareStr = "<"
Case "大于等于"
compareStr = ">="
Case "小于等于"
compareStr = "<="
Case Else
compareStr = " Like "
End Select
Select Case Combo1.Text
Case "数量", "单价", "金额", "合计", "欠款", "实付款"
FindStr = Combo1.Text & compareStr & Val(Trim(Text1.Text))
Case "日期"
FindStr = Combo1.Text & compareStr & "#" & Trim(Text1.Text) & "#"
Case Else
If Combo2.Text = "等于" Then
FindStr = Combo1.Text & compareStr & "'" & Trim(Text1.Text) & "'"
Else
FindStr = Combo1.Text & compareStr & "'*" & Trim(Text1.Text) & "*'"
End If
End Select
'开始查询
FpFind.Data2.RecordSource = "fpk"
FpFind.Data2.Refresh
FpFind.Data2.Recordset.FindFirst FindStr
If FpFind.Data2.Recordset.NoMatch Then
MsgBox "没有找到(" & Combo1.Text & ")" & Combo2.Text & "(" & Trim(Text1.Text) & ")的发票,请再试试!", vbOKOnly + 32, "查找发票"
'没有查找到时,还原记录集
RecordStr = "select * from fpk where "
RecordStr = RecordStr & "发票号='" & FpFind.DBList1.Text & "'"
FpFind.Data2.RecordSource = RecordStr
FpFind.Data2.Refresh
Exit Sub
Else
STRfield = FpFind.Data2.Recordset.Fields(0)
FpFind.DBList1.Text = STRfield
RecordStr = "select * from fpk where "
RecordStr = RecordStr & "发票号='" & STRfield & "'"
FpFind.Data2.RecordSource = RecordStr
FpFind.Data2.Refresh
Unload Me
Exit Sub
End If
End If
'多项查询
FpFind.Data2.RecordSource = "fpk"
FpFind.Data2.Refresh
FpFind.Data2.Recordset.FindFirst Trim(Text3.Text)
If FpFind.Data2.Recordset.NoMatch Then
MsgBox "没有找到(" & Text3.Text & ")的发票,请再试试!", vbOKOnly + 32, "查找发票"
'没有查找到时,还原记录集
RecordStr = "select * from fpk where "
RecordStr = RecordStr & "发票号='" & FpFind.DBList1.Text & "'"
FpFind.Data2.RecordSource = RecordStr
FpFind.Data2.Refresh
Text3.Text = ""
Exit Sub
Else
STRfield = FpFind.Data2.Recordset.Fields(0)
FpFind.DBList1.Text = STRfield
RecordStr = "select * from fpk where "
RecordStr = RecordStr & "发票号='" & STRfield & "'"
FpFind.Data2.RecordSource = RecordStr
FpFind.Data2.Refresh
Unload Me
Exit Sub
End If
End Sub
Private Sub Text1_Change()
If Trim(Text1.Text) = "" And Trim(Text3.Text) = "" Then
Sure.Enabled = False
Else
Sure.Enabled = True
End If
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 And Sure.Enabled = True Then
Sure.SetFocus
End If
End Sub
Private Sub Text2_Change()
If Trim(Text2.Text) = "" Then
AddIf.Enabled = False
Else
AddIf.Enabled = True
End If
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 And AddIf.Enabled = True Then
AddIf.SetFocus
End If
End Sub
Private Sub Text3_Change()
If Trim(Text3.Text) = "" And Trim(Text1.Text) = "" Then
Sure.Enabled = False
Else
Sure.Enabled = True
End If
End Sub
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?