lentfrm.frm
来自「图书进销存系统里面有很的多版块是图书管理系统全集」· FRM 代码 · 共 731 行 · 第 1/2 页
FRM
731 行
Left = 4920
TabIndex = 21
Top = 2160
Width = 840
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "借出天数"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 210
Index = 2
Left = 240
TabIndex = 19
Top = 2760
Width = 840
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "借出日期"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 210
Index = 1
Left = 240
TabIndex = 17
Top = 2160
Width = 840
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "类别"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 210
Index = 0
Left = 4920
TabIndex = 15
Top = 360
Width = 420
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "今天日期"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 210
Index = 9
Left = 2520
TabIndex = 11
Top = 2160
Width = 840
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "出版社"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 210
Index = 10
Left = 240
TabIndex = 10
Top = 1560
Width = 630
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "价格"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 210
Index = 11
Left = 3000
TabIndex = 9
Top = 360
Width = 420
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "书 名"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 210
Index = 12
Left = 240
TabIndex = 8
Top = 960
Width = 630
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "图书编号"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 210
Index = 13
Left = 240
TabIndex = 7
Top = 360
Width = 840
End
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "输入要还的图书编号"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000C0&
Height = 210
Index = 1
Left = 960
TabIndex = 14
Top = 720
Width = 2025
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "**<输入图书编号后回车>"
ForeColor = &H00FF0000&
Height = 180
Index = 3
Left = 5280
TabIndex = 13
Top = 720
Width = 1980
End
End
End
Attribute VB_Name = "Lentfrm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' **********************************************************************
' 描 述:银龙图书管理系统
' 中国VB网收集整理 http://www.ChinaVB.net
' QQ交流群:13047826 14356878
' 发表源码或文章请发邮件到:info@chinavb.net
' **********************************************************************Dim i As Integer
Dim rst3 As Recordset '打开表Book
Dim rst2 As Recordset '打开表BookFlag
Dim rst1 As Recordset '打开表personal
Dim rst As Recordset '打开表Type
Dim db3 As Database
Dim db2 As Database
Dim db1 As Database
Dim db As Database
Private Sub cmdExit_Click()
Unload Me
End Sub
Private Sub cmdHuanShu_Click()
'对输入的图书编号和数据库比较,如果没有借出给出提示
rst2.Seek "=", txtBookBian1.Text
If rst2.NoMatch Then
MsgBox "没有借过这本书或本书已经归还,请核对编号!", 0 + 48, "提示"
txtBookBian1.Text = ""
txtBookBian1.SetFocus
'使图书信息框架和图片框1控件(归还图书按钮)不可见
Frame2.Visible = False
Picture1.Visible = False
Exit Sub
End If
'判断数据库的是否借书字段,如果没有借出,给出提示
If rst3.Fields("是否借出") = False Then
MsgBox "此书还没有借出", 0 + 48, "提示"
Exit Sub
End If
'查询数据库借书证号,以便归还图书
rst1.Seek "=", rst2.Fields("借书证号")
rst1.Edit
'将罚款金额写入数据库
'算法:将现在罚款(txtFa.Text)加上以前罚款,等于现在的实际总罚款
rst1.Fields("罚款") = Val(txtFa.Text) + rst1.Fields("罚款")
rst1.Update
'如果本次有罚款情况,给出提示
If Val(txtFa.Text) > 0 Then
MsgBox "罚款金额已经写入数据库!", 0 + 48, "提示"
End If
'还书成功,对数据库进行相应改变,以便以后借书
rst2.Delete
rst3.Edit
rst3.Fields("是否借出") = False
rst3.Fields("借出日期") = Empty
rst3.Update
'图书编号设置为空并将光标定位在图书编号
txtBookBian1.Text = ""
txtBookBian1.SetFocus
'使图书信息框架和图片框1控件(归还图书按钮)不可见
Frame2.Visible = False
Picture1.Visible = False
MsgBox "还书完毕!按回车继续", 0 + 48, "提示"
End Sub
Private Sub Form_Load()
'连接DataBase目录下的Data.mdb数据库,打开表Book
DBpath = App.Path + "\DataBase\Data.mdb"
Set db3 = Workspaces(0).OpenDatabase(DBpath, False)
Set rst3 = db3.OpenRecordset("Book", dbOpenTable)
'对图书编号索引
rst3.Index = "图书编号"
'连接数据库,打开表BookFf
Set db2 = Workspaces(0).OpenDatabase(DBpath, False)
Set rst2 = db2.OpenRecordset("BookFf", dbOpenTable)
'对图书编号索引
rst2.Index = "图书编号"
'连接数据库,打开表Personal
Set db1 = Workspaces(0).OpenDatabase(DBpath, False)
Set rst1 = db1.OpenRecordset("Personal", dbOpenTable)
'对借书证号索引
rst1.Index = "借书证号"
'连接数据库,打开表Type
Set db = Workspaces(0).OpenDatabase(DBpath, False)
Set rst = db.OpenRecordset("Type", dbOpenTable)
'对类别索引
rst.Index = "类别"
'初始化输入框内容全部为空
txtBookBian1.Text = ""
txtBookhao1.Text = ""
txtBookname1.Text = ""
txtCost1.Text = ""
txtChuban1.Text = ""
txtLentDate1.Text = ""
txtToday.Text = ""
txtType1.Text = ""
txtLentDay.Text = ""
txtXianDing.Text = ""
txtChaoChu.Text = ""
txtFa.Text = ""
End Sub
Private Sub Form_Unload(Cancel As Integer)
'关闭窗体时,关闭所有数据库
rst1.Close
rst2.Close
rst3.Close
db1.Close
db2.Close
db3.Close
End Sub
Private Sub txtBookBian1_KeyPress(KeyAscii As Integer)
'如果在图书编号输入框按回车键,进行图书编号查询
If KeyAscii = 13 Then
rst3.Seek "=", txtBookBian1.Text
'如果没有找到图书编号,给出提示
If rst3.NoMatch Then
MsgBox "没有此图书编号,请重新填写", 0 + 48, "填写错误"
txtBookBian1.Text = ""
'txtBookBian1.SelLength
txtBookBian1.SetFocus
Exit Sub
End If
'找到图书情况
'显示图书情况框架和图片框1控件(归还图书按钮)
Frame2.Visible = True
Picture1.Visible = True
'将数据库找到的内容赋给相应输入框显示
txtBookhao1.Text = txtBookBian1.Text
txtBookname1.Text = rst3.Fields("书名") & vbNullString
txtChuban1.Text = rst3.Fields("出版社") & vbNullString
txtCost1.Text = rst3.Fields("价格") & Empty
txtLentDate1 = rst3.Fields("借出日期") & Empty
txtToday.Text = Date
txtType1.Text = rst3.Fields("类别") & vbNullString
txtLentDay.Text = Date - rst3.Fields("借出日期") & Empty
'rst.Seek "=", rst3.Fields("类别")
'将数据库中的借出天数给变量:BookDay
'BookDay 为限定借出的天数
BookDay = rst.Fields("借出天数")
txtXianDing.Text = BookDay
'判断是否超出了借书规定的天数
'算法:规定借出天数(txtLentDay)减去实际借出天数
If Val(txtLentDay.Text) - BookDay <= 0 Then
txtChaoChu.Text = "未超出"
txtFa.Text = "0"
Exit Sub
Else
'使txtChatChu输入框显示出超出的借书天数
txtChaoChu.Text = Val(txtLentDay.Text) - BookDay
End If
'使txtFa.Text显示罚款金额
'算法:每天罚款金额乘以超出总天数
txtFa.Text = Format(FaCost * Val(txtChaoChu.Text), "#.00") '计算余额
End If
End Sub
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?