📄 editbook.frm
字号:
VERSION 5.00
Begin VB.Form Form4
BorderStyle = 1 'Fixed Single
Caption = "图书信息输入"
ClientHeight = 3060
ClientLeft = 45
ClientTop = 330
ClientWidth = 4680
BeginProperty Font
Name = "Times New Roman"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "Form4"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3060
ScaleWidth = 4680
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Command2
Caption = "取 消"
Height = 375
Left = 3480
TabIndex = 11
Top = 2520
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "保 存"
Height = 375
Left = 3480
TabIndex = 10
Top = 1920
Width = 1095
End
Begin VB.Frame Frame1
Caption = "图书情况"
Height = 2775
Left = 120
TabIndex = 0
Top = 120
Width = 3255
Begin VB.ComboBox Combo1
Height = 345
Left = 840
Style = 2 'Dropdown List
TabIndex = 12
Top = 2280
Width = 1095
End
Begin VB.TextBox Text4
Height = 375
Left = 840
TabIndex = 9
Top = 1680
Width = 1935
End
Begin VB.TextBox Text3
Height = 375
Left = 840
TabIndex = 8
Top = 1200
Width = 1455
End
Begin VB.TextBox Text2
Height = 375
Left = 840
TabIndex = 7
Top = 720
Width = 2295
End
Begin VB.TextBox Text1
Height = 375
Left = 840
TabIndex = 6
Top = 240
Width = 1815
End
Begin VB.Label Label1
Caption = "书 名"
Height = 375
Index = 4
Left = 120
TabIndex = 5
Top = 840
Width = 735
End
Begin VB.Label Label1
Caption = "著 者"
Height = 375
Index = 3
Left = 120
TabIndex = 4
Top = 1320
Width = 735
End
Begin VB.Label Label1
Caption = "出 版 社"
Height = 375
Index = 2
Left = 120
TabIndex = 3
Top = 1800
Width = 735
End
Begin VB.Label Label1
Caption = "标 志"
Height = 375
Index = 1
Left = 120
TabIndex = 2
Top = 2280
Width = 735
End
Begin VB.Label Label1
Caption = "书 号"
Height = 375
Index = 0
Left = 120
TabIndex = 1
Top = 360
Width = 735
End
End
End
Attribute VB_Name = "Form4"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private num As String
Private Sub Command1_Click() '确定
Dim result As Integer
Dim i, J As Integer
'排错处理
If Text1.text = "" Then
result = MsgBox("书号栏空!", 48, "提示")
Exit Sub
End If
If Text2.text = "" Then
result = MsgBox("书名栏空!", 48, "提示")
Exit Sub
End If
If Text3.text = "" Then
result = MsgBox("著者栏空!", 48, "提示")
Exit Sub
End If
If Text4.text = "" Then
result = MsgBox("出版社栏空!", 48, "提示")
Exit Sub
End If
If Combo1.text = "" Then
result = MsgBox("标志栏栏空!", 48, "提示")
Exit Sub
End If
'增加记录时,检验关键字是否已存在
If flag2 = True Then
form2.Data1.Recordset.MoveLast
form2.Data1.Recordset.MoveFirst
For J = 1 To form2.Data1.Recordset.RecordCount
If form2.Data1.Recordset.Fields(0) = Text1.text Then
result = MsgBox("此号已存在,请重新输入!", 48, "提示")
Exit Sub
End If
form2.Data1.Recordset.MoveNext
Next J
End If
If flag2 = True Then '添加新记录
form2!Data1.Recordset.AddNew
Else '修改记录
form2!Data1.Recordset.Edit
End If
form2.Data1.Recordset.Fields(0) = Text1.text
form2.Data1.Recordset.Fields(1) = Text2.text
form2.Data1.Recordset.Fields(2) = Text3.text
form2.Data1.Recordset.Fields(3) = Text4.text
form2.Data1.Recordset.Fields(4) = Combo1.text
form2.Data1.Recordset.Update '更新记录
form2.Data1.Refresh '更新数据库
Unload Form4
End Sub
Private Sub Command2_Click() '退出
Unload Me
End Sub
Private Sub Form_Load() '窗体装载
Combo1.AddItem "可借"
Combo1.AddItem "不可借"
If flag2 = True Then
Text1.text = "" '添加操作时,对调入界面的初始化
Text2.text = ""
Text3.text = ""
Text4.text = ""
Combo1.text = "可借"
Else
num = form2.Data1.Recordset.Fields(0)
Text1.text = form2.Data1.Recordset.Fields(0) '修改操作时,对调入界面的初始化
Text2.text = form2.Data1.Recordset.Fields(1)
Text3.text = form2.Data1.Recordset.Fields(2)
Text4.text = form2.Data1.Recordset.Fields(3)
Combo1.text = form2.Data1.Recordset.Fields(4)
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -