📄 form2.frm
字号:
VERSION 5.00
Begin VB.Form Form2
Caption = "借书"
ClientHeight = 4920
ClientLeft = 60
ClientTop = 345
ClientWidth = 4590
LinkTopic = "Form2"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4920
ScaleWidth = 4590
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox Text4
DataField = "还书日期"
DataSource = "Data1"
Height = 270
Left = 1440
TabIndex = 15
Top = 3120
Width = 1695
End
Begin VB.Data Data1
Connect = "Access"
DatabaseName = "C:\My Documents\毕业设计2\libary.mdb"
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 345
Left = 240
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = "libary"
Top = 4320
Width = 4140
End
Begin VB.TextBox Text3
DataField = "借书日期"
DataSource = "Data1"
Height = 270
Left = 1440
TabIndex = 14
Top = 2640
Width = 1695
End
Begin VB.TextBox Text11
Height = 270
Left = 3240
TabIndex = 13
Top = 2640
Width = 735
End
Begin VB.TextBox Text12
Height = 270
Left = 3240
TabIndex = 12
Top = 3120
Width = 735
End
Begin VB.TextBox Text13
Height = 270
Left = 3240
TabIndex = 11
Text = "传递查询变量"
Top = 3480
Width = 735
End
Begin VB.TextBox Text5
DataField = "书籍名称"
DataSource = "Data1"
Height = 270
Left = 1440
TabIndex = 10
Top = 3480
Width = 1695
End
Begin VB.TextBox Text6
DataField = "书籍介绍"
DataSource = "Data1"
Height = 270
Left = 1440
TabIndex = 9
Top = 3840
Width = 1695
End
Begin VB.Frame Frame1
Caption = "借书"
Height = 1215
Left = 240
TabIndex = 4
Top = 360
Width = 4095
Begin VB.TextBox Text15
Height = 270
Left = 960
TabIndex = 25
Top = 720
Width = 2655
End
Begin VB.TextBox Text10
Height = 270
Left = 960
TabIndex = 24
Text = "Text10"
Top = 720
Width = 2655
End
Begin VB.TextBox Text7
Height = 270
Left = 960
TabIndex = 23
Text = "Text7"
Top = 720
Width = 2655
End
Begin VB.TextBox Text14
Height = 270
Left = 960
TabIndex = 22
Top = 360
Width = 2655
End
Begin VB.TextBox Text9
Height = 270
Left = 960
TabIndex = 21
Text = "Text7"
Top = 360
Width = 2655
End
Begin VB.TextBox Text8
Height = 270
Left = 960
TabIndex = 20
Text = "Text7"
Top = 360
Width = 2655
End
Begin VB.TextBox Text1
Height = 270
Left = 960
TabIndex = 6
Top = 360
Width = 2655
End
Begin VB.TextBox Text2
Height = 270
Left = 960
TabIndex = 5
Top = 720
Width = 2655
End
Begin VB.Label Label3
Caption = "学号:"
Height = 255
Left = 240
TabIndex = 8
Top = 360
Width = 615
End
Begin VB.Label Label4
Caption = "书号:"
Height = 255
Left = 240
TabIndex = 7
Top = 720
Width = 615
End
End
Begin VB.CommandButton Command1
Caption = "续借"
Height = 375
Left = 600
TabIndex = 3
Top = 1920
Width = 855
End
Begin VB.CommandButton Command2
Caption = "备注"
Height = 375
Left = 1440
TabIndex = 2
Top = 1920
Width = 855
End
Begin VB.CommandButton Command3
Caption = "取消"
Height = 375
Left = 2280
TabIndex = 1
Top = 1920
Width = 855
End
Begin VB.CommandButton Command4
Caption = "退出"
Height = 375
Left = 3120
TabIndex = 0
Top = 1920
Width = 855
End
Begin VB.Label Label1
Caption = "借书日期"
Height = 255
Left = 600
TabIndex = 19
Top = 2640
Width = 735
End
Begin VB.Label Label2
Caption = "借书日期"
Height = 255
Left = 600
TabIndex = 18
Top = 3120
Width = 735
End
Begin VB.Label Label5
Caption = "备注名称"
Height = 255
Left = 600
TabIndex = 17
Top = 3480
Width = 735
End
Begin VB.Label Label6
Caption = "备注内容"
Height = 615
Left = 600
TabIndex = 16
Top = 3840
Width = 735
End
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'由于把借书和还书操作成在一个窗体上,共动用了15个text控件,可以用全局变量来代替,为了方便我选择了前者
'text1与data1的学号绑定
'text2与data1的书号绑定
'text3与data1的借书日期绑定
'text4与data1的还书日期绑定
'text5与data1的书籍名称绑定
'text6与data1的书籍介绍绑定
'text7用来传递借书时输入的学号
'text8用来传递借书时的书号
'text9用来传递还书时的书号
'text10用来确认还书时的书号
'text11用来传递借书时的借书日期,与text3对应
'text12用来传递借书时的还书日期,与text4对应
'text13用来传递还书者的学号,以便查询显示该学号所借的所有书籍
'text14用来传递借书时备注的书名,与text5对应
'text15用来传递借书时备注的介绍,与text6对应
Private Sub Bor_Click()
On Error GoTo wrong
If Text10 = "" Then
MsgBox "请输入书号!", 16
Exit Sub
End If
If Text9 = "" Then
MsgBox "请输入学号", 16
Exit Sub
End If
ssql = "select * from S_no where 学号='" & Text9.Text & "'" '查询学号是否存在,不存在则退出过程
Set user_me = cn.Execute(ssql)
If user_me.EOF Then
MsgBox "学号不存在,无借书权限", 16
Exit Sub
End If
ssql = "select * from libary where 书号='" & Text10.Text & "'" '查询书是否已借出
Set user_me = cn.Execute(ssql)
If Not user_me.EOF Then
MsgBox "此书已借出,请确认输入是否正确", 16
Exit Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -