📄 frmquery.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Begin VB.Form frmQuery
BorderStyle = 3 'Fixed Dialog
Caption = "通用查询 . . ."
ClientHeight = 5700
ClientLeft = 45
ClientTop = 330
ClientWidth = 8205
ControlBox = 0 'False
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 5700
ScaleWidth = 8205
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
WhatsThisButton = -1 'True
WhatsThisHelp = -1 'True
Begin VB.TextBox txtWhere
Height = 375
Left = 480
TabIndex = 22
Top = 5040
Visible = 0 'False
Width = 1695
End
Begin VB.CommandButton Command3
Cancel = -1 'True
Caption = "取消(&C)"
Height = 375
Left = 6000
TabIndex = 17
Top = 5160
Width = 1335
End
Begin VB.PictureBox Picture1
Appearance = 0 'Flat
BackColor = &H80000004&
BorderStyle = 0 'None
ForeColor = &H80000008&
Height = 495
Left = 960
ScaleHeight = 495
ScaleWidth = 5895
TabIndex = 15
Top = 480
Width = 5895
Begin VB.Label Label1
Caption = "选择查找记录的条件"
Height = 375
Left = 240
TabIndex = 16
Top = 120
Width = 4095
End
End
Begin VB.Frame Frame1
Height = 135
Left = 240
TabIndex = 13
Top = 960
Width = 7575
End
Begin VB.PictureBox Picture2
Appearance = 0 'Flat
BackColor = &H80000004&
BorderStyle = 0 'None
ForeColor = &H80000008&
Height = 495
Left = 360
Picture = "frmQuery.frx":0000
ScaleHeight = 495
ScaleWidth = 615
TabIndex = 12
Top = 480
Width = 615
End
Begin VB.PictureBox picFind
Appearance = 0 'Flat
BackColor = &H80000004&
BorderStyle = 0 'None
ForeColor = &H80000008&
Height = 3615
Left = 360
ScaleHeight = 3615
ScaleWidth = 7575
TabIndex = 2
Top = 1200
Width = 7575
Begin VB.CommandButton Command4
Caption = "删除所有条件"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 3240
TabIndex = 21
ToolTipText = "从查询条件列表删除所有项"
Top = 1920
Width = 1455
End
Begin VB.CommandButton Command2
Caption = "或者"
Height = 375
Left = 3240
TabIndex = 10
ToolTipText = "向查询条件列表增加 Or 标记"
Top = 2880
Width = 1455
End
Begin VB.TextBox txtZhi
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 330
Left = 3240
TabIndex = 9
Top = 360
Width = 1215
End
Begin VB.CommandButton cmdJian
Caption = "删除一个条件"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 3240
TabIndex = 8
ToolTipText = "从查询条件列表删除一项"
Top = 1440
Width = 1455
End
Begin VB.CommandButton cmdTian
Caption = "增加一个条件"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 3240
TabIndex = 7
ToolTipText = "向查询条件列表增加一项"
Top = 960
Width = 1455
End
Begin VB.ListBox lstFuhao
ForeColor = &H00FF0000&
Height = 3120
Left = 2040
TabIndex = 6
Top = 360
Width = 975
End
Begin VB.ListBox lstFields
ForeColor = &H00FF0000&
Height = 3120
Left = 120
TabIndex = 5
Top = 360
Width = 1815
End
Begin VB.CommandButton Command1
Caption = "并且"
Height = 375
Left = 3240
TabIndex = 4
ToolTipText = "向查询条件列表增加 And 标记"
Top = 2400
Width = 1455
End
Begin VB.ListBox lstList
ForeColor = &H00FF0000&
Height = 3120
Left = 4800
TabIndex = 3
Top = 360
Width = 2535
End
Begin VB.Label Label4
Caption = "查询条件列表"
Height = 255
Left = 4800
TabIndex = 20
Top = 120
Width = 1335
End
Begin VB.Label Label3
Caption = "条件符号"
Height = 255
Left = 2040
TabIndex = 19
Top = 120
Width = 735
End
Begin VB.Label Label2
Caption = "字段列表"
Height = 255
Left = 120
TabIndex = 18
Top = 120
Width = 1215
End
Begin VB.Label Label18
BackStyle = 0 'Transparent
Caption = "输入查找的值"
Height = 255
Left = 3240
TabIndex = 11
Top = 120
Width = 1095
End
End
Begin MSComctlLib.TabStrip TabStrip1
Height = 4815
Left = 120
TabIndex = 1
Top = 120
Width = 7935
_ExtentX = 13996
_ExtentY = 8493
_Version = 393216
BeginProperty Tabs {1EFB6598-857C-11D1-B16A-00C0F0283628}
NumTabs = 1
BeginProperty Tab1 {1EFB659A-857C-11D1-B16A-00C0F0283628}
Caption = "通用查询"
ImageVarType = 2
EndProperty
EndProperty
End
Begin VB.CommandButton cmdOK
Caption = "确定(&O)"
Height = 375
Left = 4560
TabIndex = 0
Top = 5160
Width = 1335
End
Begin VB.Label Label9
Caption = "输入材料档案的 各个信息"
Height = 255
Left = 1080
TabIndex = 14
Top = 480
Width = 2775
End
End
Attribute VB_Name = "frmQuery"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdJian_Click()
With lstList
For i = 0 To .ListCount - 1
If .Selected(i) Then
.RemoveItem (i)
Exit Sub
End If
Next
End With
End Sub
Private Sub cmdOK_Click()
If lstList.ListCount < 1 Then
txtWhere.Text = "":
Me.Hide: Exit Sub
End If
Dim i As Integer: Dim strFind As String
If lstList.List(0) = "And" Or lstList.List(0) = "Or" Then
MsgBox "请删除查询条件列表第一项的 And 或 Or 标记!", vbExclamation
Exit Sub
End If
With lstList
For i = 1 To .ListCount - 1
If i Mod 2 <> 0 Then
Dim pass As Boolean: pass = False
If .List(i) = "And" Then pass = True: If .List(i) = "Or" Then pass = True
If Not pass Then
MsgBox "查询条件列表中第" & (i + 1) & "项需要And 或 Or标记!", vbExclamation, "通用查询"
Exit Sub: End If: End If: Next
End With
If lstList.List(lstList.ListCount - 1) = "And" Or lstList.List(lstList.ListCount - 1) = "Or" Then
MsgBox "请删除查询条件列表最后一项的 And 或 Or 标记!", vbExclamation, "通用查询"
Exit Sub
End If
With lstList
For i = 1 To .ListCount
strFind = Space(1) & strFind & .List(i - 1) & Space(1)
Next
End With
strFind = "where " & strFind: txtWhere.Text = Trim(strFind): Me.Hide
End Sub
Private Sub cmdTian_Click()
If lstFields.SelCount = 0 Then
MsgBox "没有选择要查找的字段!", vbExclamation, "WHMIS"
Exit Sub
End If
If lstFuhao.SelCount = 0 Then
MsgBox "没有选择条件符号!", vbExclamation, "WHMIS"
Exit Sub
End If
If txtZhi.Text = "" Then
MsgBox "没有输入要查找的值!", vbExclamation, "WHMIS"
Exit Sub
End If
Dim ZiDuan As String
Dim FuHao As String
Dim Zhi As String
Dim i As Integer
With lstFields
For i = 1 To .ListCount
If .Selected(i - 1) Then
ZiDuan = .List(i - 1)
Exit For
End If
Next
End With
With lstFuhao
For i = 1 To .ListCount
If .Selected(i - 1) Then
FuHao = .List(i - 1)
Exit For
End If
Next
End With
Zhi = Trim(txtZhi)
If Trim(FuHao) = "Like" Then Zhi = "%" & Zhi & "%"
For i = 0 To lstList.ListCount - 1
If lstList.Selected(i) Then
lstList.AddItem ZiDuan & Space(1) & FuHao & Space(1) & "'" & Zhi & "'", i + 1
Exit Sub
End If
Next
lstList.AddItem ZiDuan & Space(1) & FuHao & Space(1) & "'" & Zhi & "'"
End Sub
Private Sub Command1_Click()
Dim i As Integer
For i = 0 To lstList.ListCount - 1
If lstList.Selected(i) Then
lstList.AddItem "And", i + 1
Exit Sub
End If
Next
lstList.AddItem "And"
End Sub
Private Sub Command2_Click()
Dim i As Integer
For i = 0 To lstList.ListCount - 1
If lstList.Selected(i) Then
lstList.AddItem "Or", i + 1
Exit Sub
End If
Next
lstList.AddItem "Or"
End Sub
Private Sub Command3_Click()
CancelQuery = True
Unload Me
End Sub
Private Sub Command4_Click()
lstList.Clear
End Sub
Private Sub Form_Load()
Set Me.Icon = Nothing
With lstFuhao
.AddItem ">"
.AddItem ">="
.AddItem "<"
.AddItem "<="
.AddItem "="
.AddItem "Like"
End With
CancelQuery = False
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -