📄 frm_tj.frm
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "msflxgrd.ocx"
Begin VB.Form frm_tj
AutoRedraw = -1 'True
BorderStyle = 3 'Fixed Dialog
Caption = "统计与排序"
ClientHeight = 4695
ClientLeft = 45
ClientTop = 435
ClientWidth = 6300
Icon = "frm_tj.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4695
ScaleWidth = 6300
ShowInTaskbar = 0 'False
StartUpPosition = 1 '所有者中心
Begin VB.Frame Frame2
Caption = "排序方式"
Height = 855
Left = 3240
TabIndex = 7
Top = 2640
Width = 2775
Begin VB.OptionButton Option2
Caption = "年龄"
Height = 375
Left = 1440
TabIndex = 9
Top = 240
Width = 975
End
Begin VB.OptionButton Option1
Caption = "工号"
Height = 375
Left = 240
TabIndex = 8
Top = 240
Value = -1 'True
Width = 855
End
End
Begin VB.CommandButton Command2
Caption = "报表"
Height = 495
Left = 2520
TabIndex = 6
Top = 3960
Width = 1215
End
Begin VB.Data Data1
Caption = "Data1"
Connect = "Access"
DatabaseName = "db.mdb"
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 345
Left = 3720
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = "员工表"
Top = 3720
Visible = 0 'False
Width = 1140
End
Begin MSFlexGridLib.MSFlexGrid MSFlexGrid1
Bindings = "frm_tj.frx":0442
Height = 2295
Left = 240
TabIndex = 5
Top = 120
Width = 5895
_ExtentX = 10398
_ExtentY = 4048
_Version = 393216
FixedCols = 0
BackColor = 65535
FocusRect = 0
SelectionMode = 1
AllowUserResizing= 3
FormatString = ""
End
Begin VB.Frame Frame1
Caption = "统计信息"
Height = 855
Left = 240
TabIndex = 2
Top = 2640
Width = 2775
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "退休人数:0"
Height = 180
Left = 1560
TabIndex = 4
Top = 360
Width = 900
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "总人数:0"
Height = 180
Left = 120
TabIndex = 3
Top = 360
Width = 720
End
End
Begin VB.CommandButton Command3
Caption = "返回"
Height = 495
Left = 4800
TabIndex = 1
Top = 3960
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "排序"
Height = 495
Left = 240
TabIndex = 0
Top = 3960
Width = 1215
End
End
Attribute VB_Name = "frm_tj"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
If Option1.Value = True Then
Data1.RecordSource = "select * from 员工表 order by 工号"
Data1.Refresh
MSFlexGrid1.Refresh
Else
Data1.RecordSource = "select * from 员工表 order by 年龄"
Data1.Refresh
MSFlexGrid1.Refresh
End If
End Sub
Private Sub Command2_Click()
If Option1.Value = True Then
DataEnvironment1.rsCommand1.Open "select * from 员工表 order by 工号"
If DataEnvironment1.Recordsets.Count > 0 Then
DataReport1.Show 1
End If
Else
DataEnvironment1.rsCommand1.Open "select * from 员工表 order by 年龄"
If DataEnvironment1.Recordsets.Count > 0 Then
DataReport1.Show 1
End If
End If
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
Private Sub Form_Load()
Dim tx As Integer
Data1.RecordSource = "select * from 员工表"
Data1.Refresh
Label1.Caption = "总人数:" + Str(Data1.Recordset.RecordCount)
Data1.Recordset.MoveFirst
Do While Not Data1.Recordset.EOF
If Data1.Recordset.Fields("退休") = "是" Then tx = tx + 1
Data1.Recordset.MoveNext
Loop
Label2.Caption = "退休人数:" + Str(tx)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -