📄 addbook1.frm
字号:
VERSION 5.00
Begin VB.Form addbook
Caption = "增加图书"
ClientHeight = 4890
ClientLeft = 60
ClientTop = 345
ClientWidth = 6720
LinkTopic = "Form1"
ScaleHeight = 4890
ScaleWidth = 6720
StartUpPosition = 1 '所有者中心
Begin VB.Frame Frame1
Height = 4815
Left = 360
TabIndex = 0
Top = 0
Width = 6495
Begin VB.Data book
Caption = "Data1"
Connect = "Access"
DatabaseName = "db2.mdb"
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 285
Left = 2520
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = "book"
Top = 240
Visible = 0 'False
Width = 1695
End
Begin VB.Frame Frame2
Caption = "操作"
Height = 735
Left = 360
TabIndex = 19
Top = 3840
Width = 5895
Begin VB.CommandButton Command3
Caption = "退 出"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 4080
TabIndex = 22
Top = 240
Width = 975
End
Begin VB.CommandButton Command2
Caption = "重 写"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 2400
TabIndex = 21
Top = 240
Width = 855
End
Begin VB.CommandButton Command1
Caption = "确 定"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 840
TabIndex = 20
Top = 240
Width = 855
End
End
Begin VB.TextBox Text9
BackColor = &H00E0E0E0&
Height = 270
Left = 5280
TabIndex = 18
Top = 2520
Width = 615
End
Begin VB.TextBox Text8
BackColor = &H00E0E0E0&
Height = 270
Left = 1680
TabIndex = 17
Top = 3240
Width = 1335
End
Begin VB.TextBox Text7
BackColor = &H00E0E0E0&
Height = 270
Left = 4560
TabIndex = 16
Top = 1560
Width = 1335
End
Begin VB.TextBox Text6
BackColor = &H00E0E0E0&
Height = 270
Left = 1680
TabIndex = 15
Top = 2520
Width = 375
End
Begin VB.TextBox Text5
BackColor = &H00E0E0E0&
Height = 270
Left = 3360
TabIndex = 14
Top = 2520
Width = 495
End
Begin VB.TextBox Text4
BackColor = &H00E0E0E0&
Height = 270
Left = 1320
TabIndex = 13
Top = 1800
Width = 1815
End
Begin VB.TextBox Text3
BackColor = &H00E0E0E0&
Height = 270
Left = 4560
TabIndex = 12
Top = 720
Width = 1335
End
Begin VB.TextBox Text2
BackColor = &H00E0E0E0&
Height = 270
Left = 1320
TabIndex = 11
Top = 1200
Width = 1335
End
Begin VB.TextBox Text1
BackColor = &H00E0E0E0&
Height = 270
Left = 1200
TabIndex = 10
Top = 720
Width = 1455
End
Begin VB.Label Label1
Caption = "书集类别:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 8
Left = 3480
TabIndex = 9
Top = 720
Width = 1095
End
Begin VB.Label Label1
Caption = "购买日期:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 7
Left = 480
TabIndex = 8
Top = 3240
Width = 1095
End
Begin VB.Label Label1
Caption = "单 价:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 6
Left = 4440
TabIndex = 7
Top = 2520
Width = 735
End
Begin VB.Label Label1
Caption = "在库数目:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 5
Left = 480
TabIndex = 6
Top = 2520
Width = 1095
End
Begin VB.Label Label1
Caption = "总数:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 4
Left = 2760
TabIndex = 5
Top = 2520
Width = 735
End
Begin VB.Label Label1
Caption = "出版社:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 3
Left = 480
TabIndex = 4
Top = 1800
Width = 855
End
Begin VB.Label Label1
Caption = "作 者:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 2
Left = 3720
TabIndex = 3
Top = 1560
Width = 735
End
Begin VB.Label Label1
Caption = "书 名:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 1
Left = 480
TabIndex = 2
Top = 1200
Width = 735
End
Begin VB.Label Label1
Caption = "书 号:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 0
Left = 480
TabIndex = 1
Top = 720
Width = 735
End
End
End
Attribute VB_Name = "addbook"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
condition10 = "书号='" & Text1.Text & "'"
book.Recordset.MoveFirst
book.Recordset.FindFirst condition10
If Not book.Recordset.NoMatch Then
MsgBox "该书号已经存在,请换一个书号!"
Text1.SetFocus
Exit Sub
End If
book.Recordset.AddNew
book.Recordset.Fields("书号") = Text1.Text
book.Recordset.Fields("书名") = Text2.Text
book.Recordset.Fields("书籍类别") = Text3.Text
book.Recordset.Fields("作者") = Text7.Text
book.Recordset.Fields("出版社") = Text4.Text
book.Recordset.Fields("总数") = Text5.Text
book.Recordset.Fields("在库数目") = Text6.Text
book.Recordset.Fields("购买日期") = Text8.Text
book.Recordset.Fields("单价") = Text9.Text
A = MsgBox("确定要增加吗?", vbOKCancel)
If A = 1 Then
book.Recordset.Update
MsgBox "增加成功!"
book.Refresh
updatebook.Refresh
updatebook.DataGrid1.Refresh
Unload addbook
Else
book.Recordset.CancelUpdate
End If
End Sub
Private Sub Command2_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
End Sub
Private Sub Command3_Click()
Unload addbook
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -