📄 formupdata.frm
字号:
End
Begin VB.Label Label9
Caption = "单 位"
Height = 240
Left = -74775
TabIndex = 21
Top = 1440
Width = 945
End
Begin VB.Label Label8
Caption = "姓 名"
Height = 240
Left = -74760
TabIndex = 19
Top = 975
Width = 900
End
Begin VB.Label Label7
Caption = "请输入学号"
Height = 195
Left = -74775
TabIndex = 17
Top = 555
Width = 915
End
Begin VB.Image Image2
Height = 210
Left = -71070
Picture = "Formupdata.frx":0DD4
ToolTipText = "点击搜索"
Top = 525
Width = 450
End
Begin VB.Image Image1
Height = 210
Left = 3930
Picture = "Formupdata.frx":1320
ToolTipText = "点击搜索"
Top = 525
Width = 450
End
Begin VB.Label Label6
Caption = "简 介"
Height = 210
Left = 330
TabIndex = 10
Top = 2175
Width = 450
End
Begin VB.Label Label5
Caption = "出版社"
Height = 270
Left = 315
TabIndex = 9
Top = 1785
Width = 705
End
Begin VB.Label Label4
Caption = "类 别"
Height = 210
Left = 2355
TabIndex = 7
Top = 1380
Width = 450
End
Begin VB.Label Label3
BackColor = &H80000004&
Caption = "作 者"
Height = 255
Left = 300
TabIndex = 5
Top = 1365
Width = 465
End
Begin VB.Label Label2
Caption = "书 名"
Height = 210
Left = 300
TabIndex = 3
Top = 975
Width = 885
End
Begin VB.Label Label1
Caption = "请输入书号:"
Height = 255
Left = 255
TabIndex = 2
Top = 555
Width = 1095
End
End
End
Attribute VB_Name = "Formupdate"
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 Form_Load()
loadmdb Adodc1 '连接 数据库
End Sub
'更新书籍记录
'确定要更新的记录
Private Sub Image1_Click()
If Text1.Enabled = False Then
Text1.Enabled = True
Text2.Enabled = False
Text3.Enabled = False
Text4.Enabled = False
Text5.Enabled = False
Combo1.Enabled = False
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!类别
Combo1.Enabled = True
Text4.Text = rcdset!出版社
Text5.Text = "" & rcdset!简介
Text1.Enabled = False
Text2.Enabled = True
Text3.Enabled = True
Text4.Enabled = True
Text5.Enabled = True
Command1.Enabled = True
End If
End If
End Sub
'执行更新书籍记录操作
Private Sub Command1_Click()
If Text2.Text = "" Or Text3.Text = "" Or Text4.Text = "" Or Combo1.Text = "" Then
MsgBox "请完整填写必要字段,简介可不填。"
Exit Sub
Else
rcdset!书名 = Text2.Text
rcdset!作者 = Text3.Text
rcdset!类别 = Combo1.Text
rcdset!出版社 = Text4.Text
rcdset!简介 = Text5.Text
rcdset.update
Adodc1.Refresh
MsgBox "更新记录成功。"
Command1.Enabled = False
Text1.Enabled = True
Text2.Enabled = False
Text3.Enabled = False
Text4.Enabled = False
Text5.Enabled = False
Combo1.Enabled = False
End If
End Sub
'更新学生记录
'确定要更新的记录
Private Sub Image2_Click()
If Text6.Enabled = False Then
Text6.Enabled = True
Text7.Enabled = False
Text8.Enabled = False
Combo2.Enabled = False
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!备注
Combo2.Enabled = True
Text6.Enabled = False
Text7.Enabled = True
Text8.Enabled = True
Command4.Enabled = True
End If
End If
End Sub
'执行更新学生记录操作
Private Sub Command4_Click()
If Text7.Text = "" Or Combo2.Text = "" Then
MsgBox "请完整填写必要字段,简介可不填。"
Exit Sub
Else
rcdset!姓名 = Text7.Text
rcdset!备注 = Text8.Text
rcdset!单位 = Combo2.Text
rcdset.update
Adodc1.Refresh
MsgBox "更新记录成功。"
Command4.Enabled = False
Text6.Enabled = True
Text7.Enabled = False
Text8.Enabled = False
Combo2.Enabled = False
End If
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 + -