📄 分部浏览.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{00028C01-0000-0000-0000-000000000046}#1.0#0"; "DBGRID32.OCX"
Begin VB.Form 分部浏览
BorderStyle = 0 'None
Caption = "数据查询"
ClientHeight = 7545
ClientLeft = 5700
ClientTop = 5325
ClientWidth = 11925
ControlBox = 0 'False
Icon = "分部浏览.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 503
ScaleMode = 3 'Pixel
ScaleWidth = 795
ShowInTaskbar = 0 'False
Begin VB.Timer Timer2
Enabled = 0 'False
Interval = 100
Left = 360
Top = 90
End
Begin VB.Data Data1
Caption = "Data1"
Connect = "Access"
DatabaseName = ""
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 345
Left = 930
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = ""
Top = 6510
Visible = 0 'False
Width = 1275
End
Begin VB.CommandButton Command5
Caption = "返 回"
Height = 315
Left = 10200
TabIndex = 6
Top = 6615
Width = 1395
End
Begin VB.CommandButton Command4
Caption = "最后一条记录"
Height = 315
Left = 8790
TabIndex = 5
Top = 6615
Width = 1395
End
Begin VB.CommandButton Command3
Caption = "下一记录"
Height = 315
Left = 7380
TabIndex = 4
Top = 6615
Width = 1395
End
Begin VB.CommandButton Command2
Caption = "上一记录"
Height = 315
Left = 5970
TabIndex = 3
Top = 6615
Width = 1395
End
Begin VB.CommandButton Command1
Caption = "第一条记录"
Height = 315
Left = 4560
TabIndex = 2
Top = 6615
Width = 1395
End
Begin MSDBGrid.DBGrid DBGrid1
Bindings = "分部浏览.frx":0442
Height = 4815
Left = 150
OleObjectBlob = "分部浏览.frx":0456
TabIndex = 1
Top = 1410
Width = 11655
End
Begin VB.Timer Timer1
Interval = 1000
Left = 1230
Top = 120
End
Begin MSComctlLib.StatusBar StatusBar1
Align = 2 'Align Bottom
Height = 345
Left = 0
TabIndex = 7
Top = 7200
Width = 11925
_ExtentX = 21034
_ExtentY = 609
_Version = 393216
BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628}
NumPanels = 4
BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628}
AutoSize = 1
Object.Width = 4339
Picture = "分部浏览.frx":19AD
EndProperty
BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628}
AutoSize = 1
Object.Width = 4339
Picture = "分部浏览.frx":1B07
EndProperty
BeginProperty Panel3 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Alignment = 2
AutoSize = 1
Object.Width = 6103
MinWidth = 4304
Picture = "分部浏览.frx":1F59
EndProperty
BeginProperty Panel4 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Alignment = 2
AutoSize = 1
Object.Width = 6103
MinWidth = 4304
Picture = "分部浏览.frx":23AB
EndProperty
EndProperty
End
Begin VB.Shape Shape1
BorderColor = &H0000FFFF&
BorderWidth = 2
FillColor = &H00000040&
Height = 615
Left = 2910
Shape = 4 'Rounded Rectangle
Top = 210
Width = 6225
End
Begin VB.Line Line1
BorderColor = &H80000005&
BorderWidth = 3
X1 = 2
X2 = 800
Y1 = 64
Y2 = 64
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "数 据 浏 览"
BeginProperty Font
Name = "隶书"
Size = 26.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 525
Left = 3420
TabIndex = 0
Top = 240
Width = 4785
End
End
Attribute VB_Name = "分部浏览"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim Num As Integer
Private Sub Form_Load()
Me.Left = 0: Me.Top = 0
On Error GoTo Z1
Label1.Caption = 主程序.LabelName
Label1.Left = (Me.ScaleWidth - Label1.Width) / 2
Shape1.Left = (Me.ScaleWidth - Shape1.Width) / 2
Data1.DatabaseName = App.Path + "\" + "db1.mdb"
Data1.RecordSource = 主程序.FileName
Data1.Refresh
Data1.Recordset.MoveLast
Data1.Recordset.MoveFirst
Num = Data1.Recordset.RecordCount
StatusBar1.Panels(1).Text = "记录总数: " & Num
StatusBar1.Panels(2).Text = "当前记录: " & 1
StatusBar1.Panels(3).Text = "今天日期: " & Format(Date, "yyyy 年 m 月 d 日")
StatusBar1.Panels(4).Text = "当前时间: " & Time
Exit Sub
Z1:
StatusBar1.Panels(1).Text = "记录总数: " & 0
StatusBar1.Panels(2).Text = "当前记录: " & 0
StatusBar1.Panels(3).Text = "今天日期: " & Format(Date, "yyyy 年 m 月 d 日")
StatusBar1.Panels(4).Text = "当前时间: " & Time
Timer2.Enabled = True
End Sub
Private Sub Command1_Click()
Data1.Recordset.MoveFirst
StatusBar1.Panels(2).Text = "当前记录: " & 1
End Sub
Private Sub Command2_Click()
Data1.Recordset.MovePrevious
StatusBar1.Panels(2).Text = "当前记录: " & Data1.Recordset.AbsolutePosition + 1
If Data1.Recordset.AbsolutePosition <= 0 Then
MsgBox "已经是第一条记录 ! ", vbExclamation
End If
End Sub
Private Sub Command3_Click()
Data1.Recordset.MoveNext
StatusBar1.Panels(2).Text = "当前记录: " & Data1.Recordset.AbsolutePosition + 1
If Data1.Recordset.AbsolutePosition + 1 = 0 Then
StatusBar1.Panels(2).Text = "当前记录: " & Num
MsgBox "已经是最后一条记录 ! ", vbExclamation
End If
End Sub
Private Sub Command4_Click()
Data1.Recordset.MoveLast
StatusBar1.Panels(2).Text = "当前记录: " & Data1.Recordset.AbsolutePosition + 1
End Sub
Private Sub Command5_Click()
Unload Me
主程序.Show
End Sub
Private Sub DBGrid1_SelChange(Cancel As Integer)
StatusBar1.Panels(2).Text = "当前记录: " & Data1.Recordset.AbsolutePosition + 1
End Sub
Private Sub Timer1_Timer()
StatusBar1.Panels(4).Text = "当前时间: " & Time
End Sub
Private Sub Timer2_Timer()
Timer2.Enabled = False
MsgBox " 没有当前记录 ! ", vbExclamation
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -