form1.frm
来自「vb电子书籍」· FRM 代码 · 共 72 行
FRM
72 行
VERSION 5.00
Begin VB.Form Form1
Caption = "错误处理"
ClientHeight = 2550
ClientLeft = 60
ClientTop = 345
ClientWidth = 6285
LinkTopic = "Form1"
ScaleHeight = 2550
ScaleWidth = 6285
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Command1
Caption = "Command1"
Height = 495
Left = 3000
TabIndex = 0
Top = 960
Width = 1455
End
Begin VB.Label Label1
Height = 375
Left = 120
TabIndex = 1
Top = 240
Width = 1335
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'CODE Manger By BcodeXRose
'##################################################################
'## 过程名称:Command1_Click
'## 参数: 无
'##################################################################
Private Sub Command1_Click()
Dim db As Database, rs As Recordset
Dim action As Integer, sql As String
On Error GoTo openererror
MsgBox "请插入备份盘!", , "复制"
Dir$ ("a:\")
Label1.Caption = "正在复制!"
FileCopy "c:\student.mdb", "c:\temp.mdb"
Set db = OpenDatabase("c:\temp.mdb")
sql = "delete * from student where cstr(出生年月)<' " & text1
sql = sql + "'or cstr(出生年月)>'" & text2 + "'"
db.Execute sql
db.Close
If Dir$("a:\studentbak.mdb") > "" Then Kill "studentbak.mdb"
CompactDatabase "c:\temp.mdb", "a:\studentbak.mdb"
Label1.Caption = "复制完成!"
Exit Sub
openererror:
action = FileErrors(Err)
Select Case action
Case 0
Resume
Case 1
Resume Next
Case Else
fileopener = 0
Exit Sub
End Select
End Sub
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?