📄 分部录入.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 = -90
ClientTop = 0
ClientWidth = 11925
Icon = "分部录入.frx":0000
LinkTopic = "Form1"
MDIChild = -1 'True
OLEDropMode = 1 'Manual
ScaleHeight = 503
ScaleMode = 3 'Pixel
ScaleWidth = 795
Begin VB.Timer Timer2
Enabled = 0 'False
Interval = 500
Left = 1770
Top = 120
End
Begin VB.Data Data1
Caption = "Data1"
Connect = "Access"
DatabaseName = ""
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 345
Left = 9330
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = ""
Top = 270
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 = &H00C0FFFF&
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
BeginProperty Font
Name = "隶书"
Size = 26.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 525
Left = 3210
TabIndex = 0
Top = 270
Width = 285
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()
On Error GoTo Z1
Me.Left = 0: Me.Top = 0
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:
Data1.Recordset.AddNew
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
Exit Sub
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
Exit Sub
End Sub
Private Sub Command4_Click()
Data1.Recordset.MoveLast
StatusBar1.Panels(2).Text = "当前记录: " & Num
End Sub
Private Sub Command5_Click()
Unload Me
主程序.Show
End Sub
Private Sub DBGrid1_RowColChange(LastRow As Variant, ByVal LastCol As Integer)
On Error Resume Next
StatusBar1.Panels(1).Text = "记录总数: " & Data1.Recordset.RecordCount
StatusBar1.Panels(2).Text = "当前记录: " & Data1.Recordset.AbsolutePosition + 1
If DBGrid1.Columns(2) = "" Then
DBGrid1.Columns(2) = Format(Date, "yyyy年m月d日")
End If
DBGrid1.Columns(6) = DBGrid1.Columns(4) - DBGrid1.Columns(5)
End Sub
Private Sub DBGrid1_SelChange(Cancel As Integer)
If Data1.Recordset.AbsolutePosition + 1 > Num Then
StatusBar1.Panels(2).Text = "当前记录: " & Data1.Recordset.AbsolutePosition + 2
End If
End Sub
Private Sub Timer1_Timer()
StatusBar1.Panels(4).Text = "当前时间: " & Time
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -