📄 frmquery.frm
字号:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form frmQuery
BackColor = &H80000004&
Caption = "查询"
ClientHeight = 7545
ClientLeft = 60
ClientTop = 345
ClientWidth = 11805
ClipControls = 0 'False
ControlBox = 0 'False
LinkTopic = "Form1"
MDIChild = -1 'True
ScaleHeight = 7545
ScaleMode = 0 'User
ScaleWidth = 14646.47
WindowState = 2 'Maximized
Begin MSComctlLib.ListView ListView1
Height = 4455
Left = 480
TabIndex = 17
Top = 2760
Width = 10815
_ExtentX = 19076
_ExtentY = 7858
View = 3
LabelEdit = 1
LabelWrap = -1 'True
HideSelection = -1 'True
FullRowSelect = -1 'True
GridLines = -1 'True
_Version = 393217
ForeColor = -2147483640
BackColor = -2147483643
BorderStyle = 1
Appearance = 1
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
NumItems = 6
BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628}
Object.Width = 142
EndProperty
BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 1
Text = "编号"
Object.Width = 1706
EndProperty
BeginProperty ColumnHeader(3) {BDD1F052-858B-11D1-B16A-00C0F0283628}
Alignment = 2
SubItemIndex = 2
Text = "申请单位(个人)"
Object.Width = 2559
EndProperty
BeginProperty ColumnHeader(4) {BDD1F052-858B-11D1-B16A-00C0F0283628}
Alignment = 2
SubItemIndex = 3
Text = "项目名称"
Object.Width = 4265
EndProperty
BeginProperty ColumnHeader(5) {BDD1F052-858B-11D1-B16A-00C0F0283628}
Alignment = 2
SubItemIndex = 4
Text = "建设位置"
Object.Width = 8246
EndProperty
BeginProperty ColumnHeader(6) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 5
Text = "发证日期"
Object.Width = 2047
EndProperty
End
Begin VB.Frame Frame1
Caption = "查询条件"
Height = 2295
Left = 480
TabIndex = 0
Top = 240
Width = 10935
Begin VB.CommandButton Command1
Caption = "查询(&Query)"
Height = 495
Left = 7320
TabIndex = 16
Top = 1560
Width = 3135
End
Begin MSComCtl2.DTPicker DTPicker1
Height = 320
Left = 6600
TabIndex = 13
Top = 1040
Width = 1215
_ExtentX = 2143
_ExtentY = 582
_Version = 393216
Format = 153550849
CurrentDate = 39214
MaxDate = 73415
MinDate = 17899
End
Begin VB.CheckBox chkCondi
Caption = "Check1"
Height = 255
Index = 3
Left = 6000
TabIndex = 10
Top = 600
Width = 255
End
Begin VB.CheckBox chkCondi
Caption = "Check1"
Height = 255
Index = 2
Left = 360
TabIndex = 9
Top = 1560
Width = 255
End
Begin VB.CheckBox chkCondi
Caption = "Check1"
Height = 255
Index = 1
Left = 360
TabIndex = 8
Top = 1080
Width = 255
End
Begin VB.TextBox txtCondi
DataField = "建设位置"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Index = 2
Left = 2040
TabIndex = 7
Top = 1500
Width = 2895
End
Begin VB.TextBox txtCondi
DataField = "项目名称"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Index = 1
Left = 2040
TabIndex = 5
Top = 1020
Width = 2895
End
Begin VB.CheckBox chkCondi
Caption = "Check1"
Height = 255
Index = 0
Left = 360
TabIndex = 3
Top = 600
Width = 255
End
Begin VB.TextBox txtCondi
DataField = "申请人"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Index = 0
Left = 2040
TabIndex = 2
Top = 540
Width = 2895
End
Begin MSComCtl2.DTPicker DTPicker2
Height = 315
Left = 8280
TabIndex = 14
Top = 1040
Width = 1215
_ExtentX = 2143
_ExtentY = 556
_Version = 393216
Format = 153550849
CurrentDate = 39214
MaxDate = 73415
MinDate = 17899
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "至"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Index = 5
Left = 7920
TabIndex = 15
Top = 1080
Width = 180
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "自"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Index = 4
Left = 6360
TabIndex = 12
Top = 1080
Width = 180
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "发 证 日 期"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Index = 3
Left = 6360
TabIndex = 11
Top = 600
Width = 990
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "建 设 位 置"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Index = 2
Left = 720
TabIndex = 6
Top = 1560
Width = 1170
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "项 目 名 称"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Index = 1
Left = 720
TabIndex = 4
Top = 1080
Width = 1170
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "申请单位(个人)"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Index = 0
Left = 720
TabIndex = 1
Top = 600
Width = 1200
End
End
End
Attribute VB_Name = "frmQuery"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim rst As ADODB.Recordset
Dim strSQL, bagWhere As String
Dim i As Integer
Dim blnCheck As Boolean
Dim lv As ListItem
bagWhere = ""
Me.ListView1.ListItems.Clear
blnCheck = False
' On Error GoTo queryErr
For i = 0 To 3
If chkCondi(i).Value = 1 Then
blnCheck = True
End If
Next i
If Not blnCheck Then Exit Sub
For i = 0 To 2
If chkCondi(i).Value = 1 Then
If bagWhere <> "" Then
bagWhere = bagWhere & " and " & txtCondi(i).DataField & " like '%" & txtCondi(i).Text & "%'"
Else
bagWhere = bagWhere & " " & txtCondi(i).DataField & " like '%" & txtCondi(i).Text & "%'"
End If
End If
Next i
If chkCondi(3).Value = 1 Then
End If
If Trim(bagWhere) <> "" Then
bagWhere = " where " & bagWhere
End If
strSQL = "select 编号,申请人,项目名称,建设位置,县,镇,村委会,村民小组 from 基本情况 " & bagWhere
Debug.Print strSQL
Set rst = New ADODB.Recordset
rst.Open strSQL, myDB
If Not rst.EOF() Then
rst.MoveFirst
Do Until rst.EOF()
Set lv = Me.ListView1.ListItems.Add
lv.SubItems(1) = "" & rst(0)
lv.SubItems(2) = "" & rst(1)
lv.SubItems(3) = "" & rst(2)
If rst(3) <> "" Then
lv.SubItems(4) = "" & rst(3)
Else
lv.SubItems(4) = "" & rst(4) & rst(5) & rst(6) & rst(7)
End If
rst.MoveNext
Loop
End If
rst.Close
Set rst = Nothing
Exit Sub
queryErr:
MsgBox err.Description
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -