📄 formdel.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "TABCTL32.OCX"
Begin VB.Form Formdel
BorderStyle = 3 'Fixed Dialog
Caption = "删除记录"
ClientHeight = 3135
ClientLeft = 45
ClientTop = 330
ClientWidth = 4680
Icon = "Formdel.frx":0000
LinkTopic = "Form2"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3135
ScaleWidth = 4680
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Visible = 0 'False
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 210
Top = 3345
Width = 4380
_ExtentX = 7726
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin TabDlg.SSTab SSTab1
Height = 3135
Left = 0
TabIndex = 0
Top = 0
Width = 4695
_ExtentX = 8281
_ExtentY = 5530
_Version = 393216
Tabs = 2
TabsPerRow = 2
TabHeight = 520
TabCaption(0) = "书籍记录"
TabPicture(0) = "Formdel.frx":0442
Tab(0).ControlEnabled= -1 'True
Tab(0).Control(0)= "Image1"
Tab(0).Control(0).Enabled= 0 'False
Tab(0).Control(1)= "Label6"
Tab(0).Control(1).Enabled= 0 'False
Tab(0).Control(2)= "Label5"
Tab(0).Control(2).Enabled= 0 'False
Tab(0).Control(3)= "Label4"
Tab(0).Control(3).Enabled= 0 'False
Tab(0).Control(4)= "Label3"
Tab(0).Control(4).Enabled= 0 'False
Tab(0).Control(5)= "Label2"
Tab(0).Control(5).Enabled= 0 'False
Tab(0).Control(6)= "Label1"
Tab(0).Control(6).Enabled= 0 'False
Tab(0).Control(7)= "Command2"
Tab(0).Control(7).Enabled= 0 'False
Tab(0).Control(8)= "Command1"
Tab(0).Control(8).Enabled= 0 'False
Tab(0).Control(9)= "Text4"
Tab(0).Control(9).Enabled= 0 'False
Tab(0).Control(10)= "Text5"
Tab(0).Control(10).Enabled= 0 'False
Tab(0).Control(11)= "Combo1"
Tab(0).Control(11).Enabled= 0 'False
Tab(0).Control(12)= "Text3"
Tab(0).Control(12).Enabled= 0 'False
Tab(0).Control(13)= "Text2"
Tab(0).Control(13).Enabled= 0 'False
Tab(0).Control(14)= "Text1"
Tab(0).Control(14).Enabled= 0 'False
Tab(0).ControlCount= 15
TabCaption(1) = "学生记录"
TabPicture(1) = "Formdel.frx":045E
Tab(1).ControlEnabled= 0 'False
Tab(1).Control(0)= "Command3"
Tab(1).Control(1)= "Command4"
Tab(1).Control(2)= "Text6"
Tab(1).Control(3)= "Text7"
Tab(1).Control(4)= "Combo2"
Tab(1).Control(5)= "Text8"
Tab(1).Control(6)= "Image2"
Tab(1).Control(7)= "Label7"
Tab(1).Control(8)= "Label8"
Tab(1).Control(9)= "Label9"
Tab(1).Control(10)= "Label10"
Tab(1).ControlCount= 11
Begin VB.TextBox Text1
Height = 285
Left = 1440
TabIndex = 18
Top = 495
Width = 2310
End
Begin VB.TextBox Text2
Enabled = 0 'False
Height = 285
Left = 885
TabIndex = 17
Top = 915
Width = 3495
End
Begin VB.TextBox Text3
Enabled = 0 'False
Height = 285
Left = 885
TabIndex = 16
Top = 1320
Width = 1350
End
Begin VB.ComboBox Combo1
Enabled = 0 'False
Height = 300
ItemData = "Formdel.frx":047A
Left = 2865
List = "Formdel.frx":048D
TabIndex = 15
Top = 1290
Width = 1515
End
Begin VB.TextBox Text5
Enabled = 0 'False
Height = 285
Left = 885
MaxLength = 50
TabIndex = 14
Top = 2100
Width = 3525
End
Begin VB.TextBox Text4
Enabled = 0 'False
Height = 285
Left = 885
TabIndex = 13
Top = 1695
Width = 3510
End
Begin VB.CommandButton Command1
Caption = "删除"
Enabled = 0 'False
Height = 390
Left = 645
TabIndex = 12
Top = 2520
Width = 1455
End
Begin VB.CommandButton Command2
Caption = "离开"
Height = 390
Left = 2595
TabIndex = 11
Top = 2505
Width = 1455
End
Begin VB.CommandButton Command3
Caption = "离开"
Height = 390
Left = -72405
TabIndex = 6
Top = 2505
Width = 1455
End
Begin VB.CommandButton Command4
Caption = "删除"
Enabled = 0 'False
Height = 390
Left = -74355
TabIndex = 5
Top = 2520
Width = 1455
End
Begin VB.TextBox Text6
Height = 285
Left = -73695
TabIndex = 4
Top = 495
Width = 2310
End
Begin VB.TextBox Text7
Enabled = 0 'False
Height = 285
Left = -73710
TabIndex = 3
Top = 915
Width = 3120
End
Begin VB.ComboBox Combo2
Enabled = 0 'False
Height = 300
ItemData = "Formdel.frx":04CB
Left = -73710
List = "Formdel.frx":04EA
TabIndex = 2
Top = 1350
Width = 3150
End
Begin VB.TextBox Text8
Enabled = 0 'False
Height = 450
Left = -73710
MaxLength = 50
TabIndex = 1
Top = 1800
Width = 3135
End
Begin VB.Image Image2
Height = 480
Left = -71055
Picture = "Formdel.frx":054C
ToolTipText = "点击搜索"
Top = 400
Width = 480
End
Begin VB.Label Label1
Caption = "请输入书号:"
Height = 255
Left = 255
TabIndex = 24
Top = 540
Width = 1095
End
Begin VB.Label Label2
Caption = "书 名"
Height = 210
Left = 300
TabIndex = 23
Top = 960
Width = 885
End
Begin VB.Label Label3
BackColor = &H80000004&
Caption = "作 者"
Height = 255
Left = 300
TabIndex = 22
Top = 1350
Width = 465
End
Begin VB.Label Label4
Caption = "类 别"
Height = 210
Left = 2355
TabIndex = 21
Top = 1365
Width = 450
End
Begin VB.Label Label5
Caption = "出版社"
Height = 270
Left = 315
TabIndex = 20
Top = 1770
Width = 705
End
Begin VB.Label Label6
Caption = "简 介"
Height = 210
Left = 330
TabIndex = 19
Top = 2160
Width = 450
End
Begin VB.Image Image1
Height = 480
Left = 3930
Picture = "Formdel.frx":098E
ToolTipText = "点击搜索"
Top = 400
Width = 480
End
Begin VB.Label Label7
Caption = "请输入学号"
Height = 195
Left = -74760
TabIndex = 10
Top = 540
Width = 915
End
Begin VB.Label Label8
Caption = "姓 名"
Height = 240
Left = -74745
TabIndex = 9
Top = 960
Width = 900
End
Begin VB.Label Label9
Caption = "单 位"
Height = 240
Left = -74760
TabIndex = 8
Top = 1425
Width = 945
End
Begin VB.Label Label10
Caption = "备 注"
Height = 225
Left = -74760
TabIndex = 7
Top = 1890
Width = 915
End
End
End
Attribute VB_Name = "Formdel"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'*****************************************
'删除记录窗体
'********************
'所调用的API函数,自定义过程,类型,常数请参阅相应模块
Option Explicit
'Dim Adodc1.Recordset As Recordset '窗体级变量,存放ADO控件的当前记录
'通用过程,确认是否删除和执行删除操作
Private Sub suredel()
'Dim Adodc1.Recordset As Adodc.Recordset
'Set Adodc1.Recordset = Adodc1.Recordset
Dim sure As Long
sure = MsgBox("删除记录将无法恢复,确认该操作吗?", vbOKCancel)
Select Case sure
Case vbOK
Adodc1.Recordset.Delete
Adodc1.Refresh
Formmain.DataGrid1.Refresh
MsgBox "记录已删除。"
Case vbCancel
Exit Sub
End Select
End Sub
'**************窗体事件*********
'窗体加载
Private Sub Form_Load()
loadmdb Adodc1 '连接数据库
End Sub
'***************删除记录*****************
'删除书籍记录
Private Sub Image1_Click() '确定要删除的记录
If Text1.Enabled = False Then
Text1.Enabled = True
Command1.Enabled = False
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Combo1.Text = ""
Exit Sub
Else
lockrecord Adodc1, "书籍总表", "书号", Text1.Text
' Set Adodc1.Recordset = Adodc1.Recordset
If Adodc1.Recordset.RecordCount = 0 Then
MsgBox "无该记录或输入数据有误。请查正。"
Exit Sub
Else
Text2.Text = Adodc1.Recordset!书名
Text3.Text = Adodc1.Recordset!作者
Combo1.Text = Adodc1.Recordset!类别
Text4.Text = Adodc1.Recordset!出版社
Text5.Text = "" & Adodc1.Recordset!简介
Text1.Enabled = False
Command1.Enabled = True
End If
End If
End Sub
'确定删除操作并执行
Private Sub Command1_Click()
Call suredel
End Sub
'删除学生记录
Private Sub Image2_Click() '确定要删除的记录
If Text6.Enabled = False Then
Text6.Enabled = True
Command4.Enabled = False
Text7.Text = ""
Text8.Text = ""
Combo2.Text = ""
Exit Sub
Else
lockrecord Adodc1, "学生总表", "学号", Text6.Text
Set Adodc1.Recordset = Adodc1.Recordset
If Adodc1.Recordset.RecordCount = 0 Then
MsgBox "无该记录或输入数据有误。请查正。"
Exit Sub
Else
Text7.Text = Adodc1.Recordset!姓名
Combo2.Text = Adodc1.Recordset!单位
Text8.Text = "" & Adodc1.Recordset!备注
Text6.Enabled = False
Command4.Enabled = True
End If
End If
End Sub
'确定操作
Private Sub Command4_Click()
Call suredel
End Sub
'********************其他**************************
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
Private Sub Image2_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Image2.BorderStyle = 1
End Sub
Private Sub Image2_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Image2.BorderStyle = 0
End Sub
Private Sub Image1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Image1.BorderStyle = 1
End Sub
Private Sub Image1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Image1.BorderStyle = 0
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -