📄 formdel.frm
字号:
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 = 210
Left = -71055
Picture = "Formdel.frx":0DD4
ToolTipText = "点击搜索"
Top = 525
Width = 450
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 = 210
Left = 3930
Picture = "Formdel.frx":1320
ToolTipText = "点击搜索"
Top = 510
Width = 450
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 rcdset As Recordset '窗体级变量,存放ADO控件的当前记录
'通用过程,确认是否删除和执行删除操作
Private Sub suredel()
Dim sure As Long
sure = MsgBox("删除记录将无法恢复,确认该操作吗?", vbOKCancel)
Select Case sure
Case vbOK
rcdset.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 rcdset = Adodc1.Recordset
If rcdset.RecordCount = 0 Then
MsgBox "无该记录或输入数据有误。请查正。"
Exit Sub
Else
Text2.Text = rcdset!书名
Text3.Text = rcdset!作者
Combo1.Text = rcdset!类别
Text4.Text = rcdset!出版社
Text5.Text = "" & rcdset!简介
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 rcdset = Adodc1.Recordset
If rcdset.RecordCount = 0 Then
MsgBox "无该记录或输入数据有误。请查正。"
Exit Sub
Else
Text7.Text = rcdset!姓名
Combo2.Text = rcdset!单位
Text8.Text = "" & rcdset!备注
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 + -