📄 queryleague.frm
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form queryleague
Caption = "Form1"
ClientHeight = 7185
ClientLeft = 60
ClientTop = 345
ClientWidth = 11880
FillStyle = 2 'Horizontal Line
FontTransparent = 0 'False
LinkTopic = "Form1"
MDIChild = -1 'True
ScaleHeight = 7185
ScaleWidth = 11880
WindowState = 2 'Maximized
Begin MSFlexGridLib.MSFlexGrid MSFlexGrid1
Height = 4095
Left = 240
TabIndex = 16
Top = 2160
Width = 11295
_ExtentX = 19923
_ExtentY = 7223
_Version = 393216
ScrollBars = 2
End
Begin VB.TextBox Text5
Height = 375
Left = 8760
TabIndex = 15
Text = "Text5"
Top = 1440
Width = 2655
End
Begin VB.Frame Frame2
Height = 855
Left = 240
TabIndex = 9
Top = 1200
Width = 4935
Begin VB.CommandButton Command4
Caption = "关闭(&C)"
Height = 495
Left = 3600
TabIndex = 13
Top = 240
Width = 1215
End
Begin VB.CommandButton Command3
Caption = "打印预览(&P)"
Height = 495
Left = 2400
TabIndex = 12
Top = 240
Width = 1215
End
Begin VB.CommandButton Command2
Caption = "清除(&E)"
Height = 495
Left = 1200
TabIndex = 11
Top = 240
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "查询(&Q)"
Height = 495
Left = 120
TabIndex = 10
Top = 240
Width = 1095
End
End
Begin VB.TextBox Text4
Height = 375
Left = 8760
TabIndex = 8
Top = 600
Width = 2655
End
Begin VB.TextBox Text3
Height = 375
Left = 5760
TabIndex = 7
Top = 600
Width = 2295
End
Begin VB.TextBox Text2
Height = 375
Left = 3000
TabIndex = 6
Top = 600
Width = 2415
End
Begin VB.TextBox Text1
Height = 375
Left = 360
TabIndex = 5
Top = 600
Width = 2175
End
Begin VB.OptionButton Option1
Caption = " 按籍贯"
Height = 375
Index = 3
Left = 8760
TabIndex = 4
Top = 240
Width = 1215
End
Begin VB.OptionButton Option1
Caption = "按入团时间"
Height = 375
Index = 2
Left = 5760
TabIndex = 3
Top = 240
Width = 1215
End
Begin VB.OptionButton Option1
Caption = "按姓名"
Height = 375
Index = 1
Left = 3000
TabIndex = 2
Top = 240
Width = 1215
End
Begin VB.OptionButton Option1
Caption = "按班级"
Height = 375
Index = 0
Left = 360
TabIndex = 1
Top = 240
Width = 1215
End
Begin VB.Frame Frame1
Height = 1095
Left = 240
TabIndex = 0
Top = 0
Width = 11295
End
Begin VB.Label Label1
Caption = "记录总数"
Height = 255
Left = 7560
TabIndex = 14
Top = 1560
Width = 975
End
End
Attribute VB_Name = "queryleague"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public Sub showtitle()
Dim i As Integer
With MSFlexGrid1
.Cols = 11
.TextMatrix(0, 1) = "班级"
.TextMatrix(0, 2) = "编号"
.TextMatrix(0, 3) = "姓名"
.TextMatrix(0, 4) = "性别"
.TextMatrix(0, 5) = "民族"
.TextMatrix(0, 6) = "籍贯"
.TextMatrix(0, 7) = "出生日期"
.TextMatrix(0, 8) = "入团时间"
.TextMatrix(0, 9) = "家庭住址"
.TextMatrix(0, 10) = "备注"
.FixedRows = 1
For i = 0 To 10
.ColAlignment(i) = 0
Next i
.FillStyle = flexFillRepeat
.Col = 0
.Row = 0
.RowSel = 1
.ColSel = .Cols - 1
.CellAlignment = 4
.ColWidth(0) = 200
.ColWidth(1) = 700
.ColWidth(2) = 1400
.ColWidth(3) = 900
.ColWidth(4) = 600
.ColWidth(5) = 800
.ColWidth(6) = 1000
.ColWidth(7) = 1000
.ColWidth(8) = 1000
.ColWidth(9) = 4000
.FixedRows = 1
End With
End Sub
Public Sub showData()
Dim i As Integer
Dim j As Integer
Set dream = ExecuteSQL(txtSQL, Msgtext)
If dream.EOF = False Then
With MSFlexGrid1
.Rows = 1
Do While Not dream.EOF
.Rows = .Rows + 1
For i = 1 To dream.Fields.Count
Select Case dream.Fields(i - 1).Type
Case adDBDate
.TextMatrix(.Rows - 1, i) = Format(dream.Fields(i - 1) & "", "yy-mm-dd")
Case Else
.TextMatrix(.Rows - 1, i) = dream.Fields(i - 1) & " "
End Select
Next i
dream.MoveNext
Loop
End With
End If
dream.Close
End Sub
Private Sub Command1_Click()
MSFlexGrid1.Clear 'use to clear old records
Dim dd(4) As Boolean
UserName = ""
txtSQL = "select * from league where "
If Option1(0).Value Then
If Trim(Text1.Text) = " " Then
sMeg = "班级不能为空"
MsgBox sMeg, vbOKOnly + vbExclamation, "警告"
Text1.SetFocus
Exit Sub
Else
dd(0) = True
If dd(0) Then
UserName = Trim(Text1.Text) '
txtSQL = txtSQL & "班级 = '" & UserName & "' "
Else
txtSQL = txtSQL & "班级 = '" & UserName & "%' "
End If
End If
ElseIf Option1(1).Value Then
If Trim(Text2.Text) = "" Then
sMeg = "姓名不能为空"
MsgBox sMeg, vbOKOnly + vbExclamation, "警告"
Text2.SetFocus
Exit Sub
Else
dd(1) = True
If dd(1) Then
txtSQL = txtSQL & " 姓名 = '" & Text2.Text & "'"
Else
txtSQL = txtSQL & " 姓名 like '" & Text2.Text & "%'"
End If
End If
'End If
'----------------------------
ElseIf Option1(2).Value Then
If Trim(Text3.Text) = "" Then
sMeg = "请输入入团时间不能为空"
MsgBox sMeg, vbOKOnly + vbExclamation, "警告"
Text3.SetFocus
Exit Sub
Else
dd(2) = True
If dd(2) Then
txtSQL = txtSQL & " 入团时间 = '" & Text3.Text & "'"
Else
txtSQL = txtSQL & " 入团时间 like '" & Text3.Text & "%'"
End If
End If
ElseIf Option1(3).Value Then
If Trim(Combo1.Text) = " " Then
sMeg = "请输入籍贯!"
MsgBox sMeg, vbOKOnly + vbExclamation, "警告"
Combo1.SetFocus
Exit Sub
Else
dd(3) = True
If dd(3) Then
txtSQL = txtSQL & " 籍贯 = '" & Combo1.Text & " ' "
Else
txtSQL = txtSQL & " 籍贯 like '" & Combo1.Text & "%'"
End If
End If
End If
If Not (dd(0) Or dd(1) Or dd(2) Or dd(3) Or dd(4)) Then
MsgBox "请设置查询条件!", vbOKOnly + vbExclamation, "警告"
Exit Sub
End If
txtSQL = txtSQL & " order by 编号 "
Set dream = ExecuteSQL(txtSQL, Msgtext)
If dream.EOF = True Then 'exsit record ?
MsgBox "没有此记录!", 48, "警告"
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Else
With MSFlexGrid1
.Rows = 1
.TextMatrix(0, 1) = "班级"
.TextMatrix(0, 2) = "编号"
.TextMatrix(0, 3) = "姓名"
.TextMatrix(0, 4) = "性别"
.TextMatrix(0, 5) = "民族"
.TextMatrix(0, 6) = "籍贯"
.TextMatrix(0, 7) = "出生日期"
.TextMatrix(0, 8) = "入团时间"
.TextMatrix(0, 9) = "家庭住址"
.TextMatrix(0, 10) = "备注"
Do While Not dream.EOF
.Rows = .Rows + 1
.CellAlignment = 0
.TextMatrix(.Rows - 1, 0) = dream.Fields(5)
.TextMatrix(.Rows - 1, 1) = dream.Fields(0)
.TextMatrix(.Rows - 1, 2) = dream.Fields(1)
.TextMatrix(.Rows - 1, 3) = dream.Fields(2)
.TextMatrix(.Rows - 1, 4) = dream.Fields(3)
.TextMatrix(.Rows - 1, 5) = dream.Fields(4)
.TextMatrix(.Rows - 1, 7) = Format(dream.Fields(6), "yyyy-mm-dd")
.TextMatrix(.Rows - 1, 8) = Format(dream.Fields(7), "yyyy-mm-dd")
.TextMatrix(.Rows - 1, 9) = dream.Fields(8)
.TextMatrix(.Rows - 1, 10) = dream.Fields(9)
dream.MoveNext
Loop
End With
End If
dream.Close
End Sub
Private Sub Command2_Click()
showtitle
txtSQL = "select *from league order by 编号"
showData
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
End Sub
Private Sub Command4_Click()
studentmdi.StatusBar1.Panels.Item(1).Text = " "
Unload Me
End Sub
Private Sub Form_Load()
'dispaly records
showtitle
txtSQL = "select *from league order by 编号" 'sort
showData
studentmdi.StatusBar1.Panels.Item(1).Text = "查询团员信息"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -