📄 frmaddnew.frm
字号:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form FrmAddnew
Caption = "正在添加新书"
ClientHeight = 4275
ClientLeft = 60
ClientTop = 345
ClientWidth = 8775
LinkTopic = "Form1"
MaxButton = 0 'False
Picture = "FrmAddnew.frx":0000
ScaleHeight = 4275
ScaleWidth = 8775
StartUpPosition = 2 '屏幕中心
Begin VB.Frame Frame1
BackColor = &H00C0E0FF&
Caption = "书籍信息"
ForeColor = &H00FF0000&
Height = 3255
Left = 120
TabIndex = 0
Top = 120
Width = 8535
Begin MSComCtl2.DTPicker dtpRigDate
Height = 375
Left = 5040
TabIndex = 16
Top = 1560
Width = 3135
_ExtentX = 5530
_ExtentY = 661
_Version = 393216
Format = 23724033
CurrentDate = 37828
End
Begin VB.TextBox txtWriter
Height = 375
Left = 960
TabIndex = 14
Top = 1560
Width = 3015
End
Begin VB.TextBox txtBookConcern
Height = 375
Left = 5040
TabIndex = 11
Top = 960
Width = 3375
End
Begin VB.TextBox txtPage
Height = 375
Left = 960
TabIndex = 9
Top = 2160
Width = 3015
End
Begin VB.TextBox txtBookPrice
Height = 375
Left = 5040
TabIndex = 8
Top = 2160
Width = 3255
End
Begin VB.ComboBox cboType
Height = 300
Left = 960
TabIndex = 6
Top = 960
Width = 3015
End
Begin VB.TextBox txtBookName
Height = 375
Left = 5040
TabIndex = 3
Top = 360
Width = 3375
End
Begin VB.TextBox txtBookID
BackColor = &H00FFFFFF&
Height = 375
Left = 960
TabIndex = 1
Top = 360
Width = 3015
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "登记日期:"
Height = 255
Left = 4200
TabIndex = 15
Top = 1680
Width = 855
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "作者姓名:"
Height = 375
Left = 120
TabIndex = 13
Top = 1680
Width = 855
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "出版社:"
Height = 255
Left = 4320
TabIndex = 12
Top = 1080
Width = 735
End
Begin VB.Label Label22
BackStyle = 0 'Transparent
Caption = "书籍页码:"
Height = 255
Left = 120
TabIndex = 10
Top = 2280
Width = 855
End
Begin VB.Label Label26
BackStyle = 0 'Transparent
Caption = "书籍价格:"
Height = 255
Left = 4200
TabIndex = 7
Top = 2280
Width = 855
End
Begin VB.Label Label24
BackStyle = 0 'Transparent
Caption = "书籍类别:"
Height = 255
Left = 120
TabIndex = 5
Top = 1080
Width = 855
End
Begin VB.Label Label25
BackStyle = 0 'Transparent
Caption = "书籍名称:"
Height = 255
Left = 4080
TabIndex = 4
Top = 480
Width = 975
End
Begin VB.Label Label27
BackStyle = 0 'Transparent
Caption = "书籍编号:"
Height = 255
Left = 120
TabIndex = 2
Top = 480
Width = 975
End
End
Begin VB.Label Label6
BackStyle = 0 'Transparent
Caption = "清除:"
ForeColor = &H00FF00FF&
Height = 255
Left = 3960
TabIndex = 19
Top = 3600
Width = 615
End
Begin VB.Image ImageClear
Height = 540
Left = 4440
Picture = "FrmAddnew.frx":19C52
Top = 3600
Width = 540
End
Begin VB.Label Label5
BackStyle = 0 'Transparent
Caption = "关闭:"
ForeColor = &H0000FFFF&
Height = 255
Left = 7320
TabIndex = 18
Top = 3720
Width = 615
End
Begin VB.Label Label4
BackStyle = 0 'Transparent
Caption = "保存:"
ForeColor = &H000000FF&
Height = 255
Left = 120
TabIndex = 17
Top = 3720
Width = 615
End
Begin VB.Image ImageClose
Height = 255
Left = 7800
Picture = "FrmAddnew.frx":1A5A2
Top = 3840
Width = 780
End
Begin VB.Image ImageSave
Height = 255
Left = 600
Picture = "FrmAddnew.frx":1AD58
Top = 3840
Width = 765
End
End
Attribute VB_Name = "FrmAddnew"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Load()
'在窗口打开的同时进行书籍类别组合框的初始化
dtpRigDate.Value = Date
Set g_rs = g_db.OpenRecordset("bookType", dbOpenTable)
cboType.Clear
If g_rs.RecordCount > 0 Then
g_rs.MoveFirst
Do While Not g_rs.EOF
cboType.AddItem g_rs!类别代码 + "-" + g_rs!书籍类别
g_rs.MoveNext
Loop
End If
Set g_rs = Nothing
End Sub
Private Sub ImageClear_Click()
txtBookConcern = ""
txtBookID = ""
txtBookName = ""
txtBookPrice = ""
txtPage = ""
txtWriter = ""
End Sub
Private Sub ImageClose_Click()
FrmBookManage.Adodc1.Refresh
Unload Me
End Sub
Private Sub ImageSave_Click()
'进行新添加图书的保存
Set g_rs = g_db.OpenRecordset("SELECT * FROM bookInfo", dbOpenDynaset)
'判断是否存在该编号的图书
While Not g_rs.EOF
If g_rs!书籍编号 = txtBookID.Text Then
MsgBox "该编号书籍已存在!", vbOKOnly, "提示"
Exit Sub
End If
g_rs.MoveNext
Wend
'添加记录
g_rs.AddNew
'设置记录的字段值
g_rs!书籍编号 = txtBookID.Text
g_rs!书籍名称 = txtBookName.Text
g_rs!类别代码 = Mid(cboType.Text, 1, 1)
g_rs!出版社 = txtBookConcern.Text
g_rs!作者姓名 = txtWriter.Text
g_rs!书籍价格 = CStr(Val(txtBookPrice.Text))
g_rs!书籍页码 = txtPage.Text
g_rs!登记日期 = dtpRigDate.Value
g_rs!是否借出 = False
' 保存修改!!!
g_rs.Update
Set g_rs = Nothing
MsgBox "新书添加完毕", vbOKOnly, "提示"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -