?? 分部刪除.frm
字號:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.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"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 504.002
ScaleMode = 0 'User
ScaleWidth = 795
ShowInTaskbar = 0 'False
Begin VB.Timer Timer2
Enabled = 0 'False
Interval = 500
Left = 1860
Top = 150
End
Begin MSComDlg.CommonDialog CommonDialog1
Left = 780
Top = 5190
_ExtentX = 847
_ExtentY = 847
_Version = 393216
CancelError = -1 'True
DialogTitle = "文件另存為"
End
Begin VB.CommandButton Command1
Caption = "刪除全部記錄"
Height = 315
Left = 1740
TabIndex = 8
Top = 6615
Width = 1395
End
Begin VB.CommandButton Command2
Caption = "刪除記錄"
Height = 315
Left = 3150
TabIndex = 7
Top = 6615
Width = 1395
End
Begin VB.Data Data1
Caption = "Data1"
Connect = "Access"
DatabaseName = ""
DefaultCursorType= 0 '缺省游標
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 345
Left = 210
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = ""
Top = 6540
Visible = 0 'False
Width = 1275
End
Begin VB.CommandButton Command7
Caption = "返 回"
Height = 315
Left = 10200
TabIndex = 6
Top = 6615
Width = 1395
End
Begin VB.CommandButton Command6
Caption = "最后一條記錄"
Height = 315
Left = 8790
TabIndex = 5
Top = 6615
Width = 1395
End
Begin VB.CommandButton Command5
Caption = "下一記錄"
Height = 315
Left = 7380
TabIndex = 4
Top = 6615
Width = 1395
End
Begin VB.CommandButton Command4
Caption = "上一記錄"
Height = 315
Left = 5970
TabIndex = 3
Top = 6615
Width = 1395
End
Begin VB.CommandButton Command3
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 = 9
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 = &H000000FF&
BorderWidth = 2
FillColor = &H00000040&
Height = 615
Left = 2700
Shape = 4 'Rounded Rectangle
Top = 210
Width = 6225
End
Begin VB.Line Line1
BorderColor = &H80000005&
BorderWidth = 3
X1 = 2
X2 = 800
Y1 = 64.127
Y2 = 64.127
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 = 3450
TabIndex = 0
Top = 210
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, Record As Integer, Result 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:
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.Edit
Do While Data1.Recordset.EOF = False
Data1.Recordset.Delete
Data1.Recordset.MoveNext
Loop
Command1.Enabled = False: Command2.Enabled = False: Command3.Enabled = False: Command4.Enabled = False
Command5.Enabled = False: Command6.Enabled = False
End Sub
Private Sub Command2_Click()
'Record = DBGrid1.Row
Dim T As Integer
Data1.Recordset.Delete
T = Data1.Recordset.RecordCount
StatusBar1.Panels(1).Text = "記錄總數: " & T
End Sub
Private Sub Command3_Click()
Data1.Recordset.MoveFirst
StatusBar1.Panels(2).Text = "當前記錄: " & 1
End Sub
Private Sub Command4_Click()
Data1.Recordset.MovePrevious
StatusBar1.Panels(2).Text = "當前記錄: " & Data1.Recordset.AbsolutePosition + 1
If Data1.Recordset.AbsolutePosition <= 0 Then
Data1.Recordset.MoveFirst
StatusBar1.Panels(2).Text = "當前記錄: " & 1
Result = MsgBox("已經是第一條記錄 ! ", vbExclamation)
End If
Exit Sub
End Sub
Private Sub Command5_Click()
Data1.Recordset.MoveNext
StatusBar1.Panels(2).Text = "當前記錄: " & Data1.Recordset.AbsolutePosition + 1
If Data1.Recordset.AbsolutePosition + 1 = 0 Then
StatusBar1.Panels(2).Text = "當前記錄: " & Num
Result = MsgBox("已經是最后一條記錄 ! ", vbExclamation)
End If
Exit Sub
End Sub
Private Sub Command6_Click()
Data1.Recordset.MoveLast
StatusBar1.Panels(2).Text = "當前記錄: " & Data1.Recordset.AbsolutePosition + 1
End Sub
Private Sub Command7_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 + -