📄 form5.frm
字号:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomct2.ocx"
Begin VB.Form form5
BackColor = &H80000008&
BorderStyle = 0 'None
Caption = "Form5"
ClientHeight = 6165
ClientLeft = 0
ClientTop = 0
ClientWidth = 10980
LinkTopic = "Form5"
Picture = "Form5.frx":0000
ScaleHeight = 6165
ScaleWidth = 10980
ShowInTaskbar = 0 'False
StartUpPosition = 1 '所有者中心
Begin VB.CommandButton Command1
Caption = "确定添加"
Default = -1 'True
Height = 495
Left = 6600
TabIndex = 7
Top = -3000
Width = 1575
End
Begin VB.TextBox Text6
Appearance = 0 'Flat
BeginProperty Font
Name = "楷体_GB2312"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 2025
Left = 5280
MultiLine = -1 'True
TabIndex = 6
Top = 4080
Width = 5055
End
Begin VB.TextBox Text4
Alignment = 1 'Right Justify
Appearance = 0 'Flat
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 360
Left = 2160
TabIndex = 5
Top = 3150
Width = 735
End
Begin VB.TextBox Text5
Appearance = 0 'Flat
BeginProperty Font
Name = "楷体_GB2312"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 2025
Left = 840
MultiLine = -1 'True
TabIndex = 4
Top = 4080
Width = 4095
End
Begin VB.TextBox Text3
Alignment = 1 'Right Justify
Appearance = 0 'Flat
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
Left = 2160
TabIndex = 3
Top = 2600
Width = 735
End
Begin MSComCtl2.DTPicker DTPicker1
Height = 375
Left = 2160
TabIndex = 2
Top = 2040
Width = 2055
_ExtentX = 3625
_ExtentY = 661
_Version = 393216
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Format = 20119553
CurrentDate = 38589
End
Begin VB.TextBox Text2
Appearance = 0 'Flat
BeginProperty Font
Name = "楷体_GB2312"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 2160
TabIndex = 1
Top = 1440
Width = 2055
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
BeginProperty Font
Name = "楷体_GB2312"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 2160
TabIndex = 0
Top = 795
Width = 2055
End
Begin VB.Timer Timer1
Interval = 200
Left = 6360
Top = 5400
End
Begin VB.Image Image5
Appearance = 0 'Flat
BorderStyle = 1 'Fixed Single
Height = 375
Left = 8290
MouseIcon = "Form5.frx":2EE01
MousePointer = 99 'Custom
Top = 1300
Width = 1305
End
Begin VB.Image Image4
Appearance = 0 'Flat
BorderStyle = 1 'Fixed Single
Height = 375
Left = 6600
MouseIcon = "Form5.frx":2EF53
MousePointer = 99 'Custom
Top = 1300
Width = 1305
End
Begin VB.Image Image3
Appearance = 0 'Flat
BorderStyle = 1 'Fixed Single
Height = 375
Left = 8290
MouseIcon = "Form5.frx":2F0A5
MousePointer = 99 'Custom
Top = 740
Width = 1305
End
Begin VB.Image Image2
Appearance = 0 'Flat
BorderStyle = 1 'Fixed Single
Height = 375
Left = 6600
MouseIcon = "Form5.frx":2F1F7
MousePointer = 99 'Custom
Top = 740
Width = 1310
End
Begin VB.Image Image1
Height = 375
Left = 0
MouseIcon = "Form5.frx":2F349
MousePointer = 99 'Custom
Top = 0
Width = 375
End
End
Attribute VB_Name = "form5"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Call Image2_Click
End Sub
Private Sub Form_Load()
utid
End Sub
Private Sub Image1_Click()
Unload Me
End Sub
Private Sub Image2_Click()
If admin = False Then
MsgBox "非管理员不可操作,谢谢合作", vbInformation, "错误操作"
Exit Sub
End If
If qy1.State = adStateOpen Then
qy1.Close
End If
If Text1.Text = "" And Text2.Text = "" Then
MsgBox "编号和姓名不可为空,请检查看输入", vbInformation, "输入错误"
Exit Sub
End If
qy1.Open "select * from 图书信息", cnn, adOpenKeyset, adLockOptimistic, adCmdText
Do While qy1.EOF = False
If qy1.Fields(0) = Text1.Text Then
Dim str1 As String
str1 = MsgBox("您输入的图书编号己存在,是否将图书数量累加到原始图书上?", vbQuestion + vbYesNo, "编号重复")
If str1 = vbYes Then
qy1.Fields(5) = Int(qy1.Fields(5)) + Int(Text3.Text)
qy1.Fields(6) = Int(qy1.Fields(6)) + Int(Text3.Text)
qy1.Update
MsgBox "添加成功!请验证!", vbInformation, "累加成功"
Exit Sub
Else
Text1.Text = ""
Exit Sub
End If
Else
qy1.MoveNext
End If
Loop
qy1.AddNew
qy1.Fields(0) = Text1.Text '图书编号
qy1.Fields(1) = Text2.Text '图书名称
qy1.Fields(2) = DTPicker1.Value '出版日期
qy1.Fields(3) = Text5.Text '图书简介
qy1.Fields(4) = Text6.Text '图书其它
qy1.Fields(5) = Text3.Text '图书总数
qy1.Fields(6) = Text3.Text '剩余数量
qy1.Update
MsgBox "数据己添加成功", vbInformation, "添加成功"
Text1.Text = ""
End Sub
Private Sub Image3_Click()
If admin = False Then
MsgBox "非管理员不可操作,谢谢合作", vbInformation, "错误操作"
Exit Sub
End If
If qy1.State = adStateOpen Then
qy1.Close
End If
If Text1.Text = "" And Text2.Text = "" Then
MsgBox "编号和姓名不可为空,请检查看输入", vbInformation, "输入错误"
Exit Sub
End If
qy1.Open "select * from 图书信息", cnn, adOpenKeyset, adLockOptimistic, adCmdText
Do While qy1.EOF = False
If qy1.Fields(0) = Text1.Text Then
qy1.Fields(1) = Text2.Text '图书名称
qy1.Fields(2) = DTPicker1.Value '出版日期
qy1.Fields(3) = Text5.Text '图书简介
qy1.Fields(4) = Text6.Text '图书其它
qy1.Fields(5) = Text3.Text '图书总数
qy1.Fields(6) = Text3.Text '剩余数量
qy1.Update
MsgBox "数据己修改成功", vbInformation, "修改成功"
Else
qy1.MoveNext
End If
Loop
End Sub
Private Sub Image4_Click()
MsgBox "取消该功能"
End Sub
Private Sub Image5_Click()
If systembooks - bookindex <= 0 Then
MsgBox "您己经超出借书所限本数!", vbInformation, id + "您好!"
Exit Sub
End If
'--------------检测图书剩余
If qy2.State = adStateOpen Then
qy2.Close
End If
qy2.Open "select * from 图书信息 where 图书编号='" & Text1.Text & "'", cnn, adOpenKeyset, adLockOptimistic, adCmdText
If qy2.Fields(6) <= 0 Then
MsgBox "您所借图书己被其他用户借走,目前剩余为0本", vbInformation, idname + "您好"
Exit Sub
End If
'--------------
If admin = True Then
If qy1.State = adStateOpen Then
qy1.Close
End If
qy1.Open "select * from 借书信息", cnn, adOpenKeyset, adLockOptimistic, adCmdText
If qy3.State = adStateOpen Then
qy3.Close
End If
qy3.Open "select * from 个人信息 where 学号='" & id & "'", cnn, adOpenKeyset, adLockOptimistic, adCmdText
If qy2.Fields(6) <= 0 Then
MsgBox "您所借图书己被其他用户借走,目前剩余为0本", vbInformation, idname + "您好"
Exit Sub
End If
qy1.AddNew
qy1.Fields(1) = id '学号
qy1.Fields(2) = Text1.Text '图书编号
qy1.Fields(3) = Date '借书日期
qy1.Fields(4) = idname '操作人
Dim sstr1 As String '设定归还期限延长30天
sstr1 = "30"
qy1.Fields(5) = Int(Date + sstr1) '借出最终期限
qy1.Fields(6) = "0"
qy2.Fields(6) = qy2.Fields(6) - 1 '图书数量-1
qy3.Fields(9) = qy3.Fields(9) + 1 '借书数量+1
qy1.Update
qy2.Update
qy3.Update
MsgBox "您的借书记录己成功,请继续操作!", vbInformation, idname + "您好"
Exit Sub
End If
'----------
If qy1.State = adStateOpen Then
qy1.Close
End If
qy1.Open "select * from 借书批准处", cnn, adOpenKeyset, adLockOptimistic, adCmdText
qy1.AddNew
qy1.Fields(1) = id '学号
qy1.Fields(2) = Text1.Text '图书编号
qy1.Fields(3) = Date '借书日期
qy1.Fields(4) = idname '操作人
Dim sstr2 As String '设定归还期限延长30天
sstr2 = "30"
qy1.Fields(5) = Int(Date + sstr2) '借出最终期限
qy1.Fields(6) = "0"
qy1.Fields(7) = "1"
qy1.Update
If qy2.State = adStateOpen Then
qy2.Close
End If
qy2.Open "select * from 用户交流", cnn, adOpenKeyset, adLockOptimistic, adCmdText
qy2.AddNew
qy2.Fields(0) = qy1.Fields(0)
qy2.Fields(1) = id '学号
qy2.Fields(2) = adminid '当前管理员
qy2.Fields(3) = "ID为:" + id + "的用户向管理员请求借出编号为" + Text1.Text + "的图书!"
qy2.Fields(4) = Date
qy2.Fields(5) = "0"
qy2.Update
MsgBox "您的请求己提交,需要管理员来回复您!", vbInformation, idname + "您好"
Exit Sub
End Sub
Private Sub Timer1_Timer()
form5.Top = form1.Top + 2900
form5.Left = form1.Left + 1060
End Sub
Private Sub utid()
If ifuser = "0" Then
If qy1.State = adStateOpen Then
qy1.Close
End If
qy1.Open "select * from 图书信息 where 图书编号='" & tkUserID & "'", cnn, adOpenKeyset, adLockOptimistic, adCmdText
Text1.Text = tkUserID '图书编号
Text2.Text = qy1.Fields(1) '图书名称
DTPicker1.Value = qy1.Fields(2) '出版日期
Text5.Text = qy1.Fields(3) '图书简介
Text6.Text = qy1.Fields(4) '图书其它
Text3.Text = qy1.Fields(5) '图书总数
Text4.Text = qy1.Fields(6) '剩余数量
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -