📄 frmquery.frm
字号:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form FrmQuery
BorderStyle = 1 'Fixed Single
Caption = "查询"
ClientHeight = 4305
ClientLeft = 3825
ClientTop = 3210
ClientWidth = 5220
Icon = "FrmQuery.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 4305
ScaleWidth = 5220
Begin VB.CommandButton Command2
Caption = "退出"
Height = 420
Left = 3330
TabIndex = 8
Top = 3825
Width = 1230
End
Begin VB.CommandButton Command1
Caption = "查询"
Height = 420
Left = 450
Picture = "FrmQuery.frx":0C62
TabIndex = 7
Top = 3825
Width = 1185
End
Begin VB.Frame Frame1
Caption = "查询条件"
Height = 3585
Left = 90
TabIndex = 6
Top = 135
Width = 5055
Begin VB.Frame Frame3
Height = 555
Left = 1350
TabIndex = 24
Top = 135
Width = 3075
Begin VB.OptionButton Option1
Caption = "男"
Height = 195
Left = 360
TabIndex = 0
Top = 225
Value = -1 'True
Width = 825
End
Begin VB.OptionButton Option2
Caption = "女"
Height = 240
Left = 1575
TabIndex = 1
Top = 225
Width = 915
End
End
Begin VB.Frame Frame2
Enabled = 0 'False
Height = 555
Left = 1395
TabIndex = 21
Top = 2970
Width = 3165
Begin VB.OptionButton Option4
Caption = "离婚或丧偶"
Height = 195
Left = 1170
TabIndex = 23
Top = 225
Width = 1590
End
Begin VB.OptionButton Option3
Caption = "未婚"
Height = 195
Left = 135
TabIndex = 22
Top = 225
Width = 690
End
End
Begin VB.CheckBox Check5
Caption = "婚姻状况"
Height = 195
Left = 270
TabIndex = 20
Top = 3195
Width = 1050
End
Begin MSComCtl2.DTPicker DTPicker2
Height = 330
Left = 3105
TabIndex = 19
Top = 2475
Width = 1410
_ExtentX = 2487
_ExtentY = 582
_Version = 393216
Enabled = 0 'False
Format = 48300033
CurrentDate = 38578
End
Begin VB.TextBox txtAge1
Height = 330
Left = 1350
TabIndex = 2
Top = 780
Width = 1275
End
Begin VB.TextBox TxtAera
Height = 330
Left = 1350
TabIndex = 5
Top = 1935
Width = 2895
End
Begin VB.TextBox txtAge2
Height = 330
Left = 3375
TabIndex = 3
Top = 780
Width = 1050
End
Begin MSComCtl2.DTPicker DTPicker1
Height = 330
Left = 1350
TabIndex = 15
Top = 2475
Width = 1410
_ExtentX = 2487
_ExtentY = 582
_Version = 393216
Enabled = 0 'False
Format = 48300033
CurrentDate = 38578
End
Begin VB.CheckBox Check4
Caption = "入会时间"
Height = 240
Left = 270
TabIndex = 14
Top = 2520
Width = 1050
End
Begin VB.CheckBox Check3
Caption = "户口"
Height = 240
Left = 270
TabIndex = 11
Top = 2040
Value = 1 'Checked
Width = 690
End
Begin VB.CheckBox Check2
Caption = "身高"
Height = 195
Left = 270
TabIndex = 10
Top = 1455
Value = 1 'Checked
Width = 735
End
Begin VB.CheckBox Check1
Caption = "年龄"
Height = 240
Left = 270
TabIndex = 9
Top = 825
Value = 1 'Checked
Width = 690
End
Begin VB.TextBox TxtHeight
Height = 375
Left = 1935
TabIndex = 4
Top = 1350
Width = 1275
End
Begin VB.Label Label6
Caption = "性别"
Height = 240
Left = 540
TabIndex = 25
Top = 315
Width = 600
End
Begin VB.Label Label5
Caption = "到"
Height = 195
Left = 2835
TabIndex = 18
Top = 2520
Width = 195
End
Begin VB.Label Label1
Caption = "岁 到"
Height = 240
Left = 2700
TabIndex = 17
Top = 825
Width = 645
End
Begin VB.Label Label2
Caption = "岁"
Height = 285
Left = 4500
TabIndex = 16
Top = 825
Width = 285
End
Begin VB.Label Label4
Caption = "不低于"
Height = 210
Left = 1350
TabIndex = 13
Top = 1440
Width = 630
End
Begin VB.Label Label3
Caption = "米"
Height = 195
Left = 3375
TabIndex = 12
Top = 1440
Width = 225
End
End
End
Attribute VB_Name = "FrmQuery"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Sex As String
Dim tmpStr As String
Private Sub Check1_Click()
If Check1.Value = Checked Then
txtAge1.Enabled = True
txtAge2.Enabled = True
txtAge1.Text = ""
txtAge2.Text = ""
Else
txtAge1.Text = "不限"
txtAge2.Text = "不限"
txtAge1.Enabled = False
txtAge2.Enabled = False
End If
End Sub
Private Sub Check2_Click()
If Check2.Value = Checked Then
TxtHeight.Enabled = True
TxtHeight.Text = ""
Else
TxtHeight.Text = "不限"
TxtHeight.Enabled = False
End If
End Sub
Private Sub Check3_Click()
If Check3.Value = Checked Then
TxtAera.Enabled = True
TxtAera.Text = ""
Else
TxtAera.Text = "不限"
TxtAera.Enabled = False
End If
End Sub
Private Sub Check4_Click()
If Check4.Value = Checked Then
DTPicker1.Enabled = True
DTPicker2.Enabled = True
Else
DTPicker1.Enabled = False
DTPicker2.Enabled = False
End If
End Sub
Private Sub Check5_Click()
If Check5.Value = Checked Then
Frame2.Enabled = True
Else
Option3.Value = False
Option4.Value = False
Frame2.Enabled = False
End If
End Sub
Private Sub Command1_Click()
On Error Resume Next
Me.MousePointer = 11
If Option1.Value = True Then
Sex = "性别='男'"
ElseIf Option2.Value = True Then
Sex = "性别='女'"
Else
'Sex = "性别='男' or 性别=" & "'女'"
End If
SearchStr = SearchStr & Sex
SearchStr2 = SearchStr2 & Sex
If Check1.Value = Checked Then
If txtAge1.Text <> "" And txtAge2.Text <> "" Then
SearchStr = SearchStr & "and 年龄>=" & txtAge1.Text & " and 年龄<=" & txtAge2.Text
SearchStr2 = SearchStr2 & "and 年龄>=" & txtAge1.Text & " and 年龄<=" & txtAge2.Text
End If
End If
If Check2.Value = Checked Then
If TxtHeight.Text <> "" Then
SearchStr = SearchStr & "and 身高>=" & TxtHeight.Text
SearchStr2 = SearchStr2 & "and 身高>=" & TxtHeight.Text
End If
End If
If Check3.Value = Checked Then
If TxtAera.Text <> "" Then
SearchStr = SearchStr & "and 户口 like '%" & TxtAera.Text & "%'"
SearchStr2 = SearchStr2 & "and 户口 like '%" & TxtAera.Text & "%'"
End If
End If
If Check4.Value = Checked Then
SearchStr = SearchStr & "and 入会时间>= #" & DTPicker1.Value & "# and 入会时间<= #" & DTPicker2.Value & "#"
SearchStr2 = SearchStr2 & "and 入会时间>= #" & DTPicker1.Value & "# and 入会时间<= #" & DTPicker2.Value & "#"
End If
If Check5.Value = Checked Then
If Option3.Value = True Then
SearchStr = SearchStr & "and 婚姻 like '%未%'"
SearchStr2 = SearchStr2 & "and 婚姻 like '%未%'"
Else
SearchStr = SearchStr & "and 婚姻 not like '%未%'"
SearchStr2 = SearchStr2 & "and 婚姻 not like '%未%'"
End If
Else
End If
SearchStr = SearchStr & " order by 编号"
SearchStr2 = SearchStr2 & " order by 编号"
tmpStr = SearchStr
FrmMain.AdoQuery.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\mgydb.mdb;Persist Security Info=False"
FrmMain.AdoQuery.CommandType = adCmdText
FrmInfo.AdoQuery2.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\mgydb.mdb;Persist Security Info=False"
FrmInfo.AdoQuery2.CommandType = adCmdText
FrmMain.AdoQuery.RecordSource = SearchStr
FrmInfo.AdoQuery2.RecordSource = SearchStr2
' MsgBox SearchStr
FrmMain.AdoQuery.Refresh
FrmInfo.AdoQuery2.Refresh
FrmMain.DataGrid2.Columns.Item(0).Width = 550
FrmMain.DataGrid2.Columns.Item(1).Width = 400
FrmMain.DataGrid2.Columns.Item(2).Width = 400
FrmMain.DataGrid2.Columns.Item(3).Width = 500
FrmMain.DataGrid2.Columns.Item(4).Width = 500
FrmMain.DataGrid2.Columns.Item(5).Width = 500
FrmMain.DataGrid2.Columns.Item(6).Width = 1000
FrmMain.DataGrid2.Columns.Item(7).Width = 600
FrmMain.DataGrid2.Columns.Item(8).Width = 500
FrmMain.DataGrid2.Columns.Item(9).Width = 600
FrmMain.DataGrid2.Columns.Item(10).Width = 1700
FrmMain.DataGrid2.Columns.Item(11).Width = 700
FrmMain.DataGrid2.Columns.Item(12).Width = 600
FrmMain.DataGrid2.Columns.Item(13).Width = 4900
FrmMain.DataGrid2.Columns.Item(14).Width = 1000
FrmMain.SSTab1.Tab = 1
FrmMain.StatusBar1.Panels.Item(3).Text = "共有 " & FrmMain.AdoQuery.Recordset.RecordCount & " 个符合条件的记录"
SearchStr = "select 编号,年龄,属相,身高,体重,学历,职业,收入,住房,婚姻,孩子,户口,姓名,要求对方,交往情况 from mgydb where "
HasQuery = True
Unload Me
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
SearchStr = "select 编号,年龄,属相,身高,体重,学历,职业,收入,住房,婚姻,孩子,户口,姓名,要求对方,交往情况 from mgydb where "
SearchStr2 = "select * from mgydb where "
End Sub
Private Sub Form_Unload(Cancel As Integer)
SearchStr = tmpStr
End Sub
Private Sub Option5_Click()
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -