?? ?
字號:
VERSION 5.00
Begin VB.Form 圖書借閱
BorderStyle = 1 'Fixed Single
Caption = "借書處理"
ClientHeight = 4095
ClientLeft = 45
ClientTop = 435
ClientWidth = 3855
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4095
ScaleWidth = 3855
StartUpPosition = 2 '屏幕中心
Begin VB.Frame Frame3
Caption = "輸入所借圖書的圖書編號"
Height = 855
Left = 600
TabIndex = 2
Top = 2880
Width = 2655
Begin VB.CommandButton Command2
Caption = "確定"
Height = 255
Left = 1920
TabIndex = 6
Top = 360
Width = 615
End
Begin VB.TextBox Text5
Height = 270
Left = 120
TabIndex = 5
Top = 360
Width = 1455
End
End
Begin VB.Frame Frame2
Caption = "讀者借書情況"
Height = 1455
Left = 600
TabIndex = 1
Top = 1200
Width = 2655
Begin VB.Label Label6
BackColor = &H80000009&
BorderStyle = 1 'Fixed Single
Height = 255
Left = 1080
TabIndex = 12
Top = 1080
Width = 1215
End
Begin VB.Label Label5
BackColor = &H80000009&
BorderStyle = 1 'Fixed Single
Height = 255
Left = 1080
TabIndex = 11
Top = 720
Width = 1215
End
Begin VB.Label Label4
BackColor = &H80000009&
BorderStyle = 1 'Fixed Single
Height = 255
Left = 1080
TabIndex = 10
Top = 360
Width = 1215
End
Begin VB.Label Label3
Caption = "可借書數"
Height = 255
Left = 120
TabIndex = 9
Top = 1080
Width = 735
End
Begin VB.Label Label2
Caption = "借書總數"
Height = 255
Left = 120
TabIndex = 8
Top = 720
Width = 855
End
Begin VB.Label Label1
Caption = "姓 名"
Height = 255
Left = 120
TabIndex = 7
Top = 360
Width = 735
End
End
Begin VB.Frame Frame1
Caption = "輸入借書證號"
Height = 855
Left = 600
TabIndex = 0
Top = 120
Width = 2655
Begin VB.CommandButton Command1
Caption = "確定"
Height = 255
Left = 1800
TabIndex = 4
Top = 360
Width = 735
End
Begin VB.TextBox Text1
Height = 270
Left = 120
TabIndex = 3
Top = 360
Width = 1455
End
End
End
Attribute VB_Name = "圖書借閱"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public sqltxt As String
Public rno As String '保存讀者借書證號
Public bno As String '保存讀者圖書編號
Public xm As String '保存讀者姓名
Public dw As String '保存讀者單位
Public rs As ADODB.Recordset
Private Sub Command1_Click() '輸入借書證號確定
rno = Trim(Text1.Text)
If rno = "" Then
MsgBox "借書證號不能為空,請輸入", vbOKOnly, "信息提示"
Command2.Enabled = False
Else
sqltxt = "select *from reader where 借書證號='" + rno + "'"
Set rs = exesql(sqltxt)
If rs.RecordCount = 0 Then
MsgBox "該讀者未登記,不能借書", vbOKOnly, "信息提示"
Command2.Enabled = False
Else
Label4.Caption = rs.Fields("姓名")
Label5.Caption = Str(rs.Fields("借書總數")) - 0
Label6.Caption = Str(rs.Fields("借書總數")) - rs.Fields("已借書數")
If Val(Trim(Label6.Caption)) > 0 Then
xm = rs.Fields("姓名")
dw = rs.Fields("單位")
Command2.Enabled = True
Else
MsgBox "該讀者已借滿圖書,不能再借!", vbOKOnly, "信息提示"
Command2.Enabled = False
End If
End If
End If
End Sub
Private Sub Command2_Click() '輸入圖書編號確定
If Val(Trim(Label6.Caption)) = 0 Then
MsgBox "該讀者已借滿圖書,不能再借!", vbOKOnly, "信息提示"
Command2.Enabled = False
Exit Sub
End If
bno = Trim(Text5.Text)
If bno = "" Then
MsgBox "圖書編號不能為空,請輸入", vbOKOnly, "信息提示"
Command2.Enabled = False
Else
sqltxt = "select *from book where 圖書編號='" + bno + "'"
Set bs = exesql(sqltxt)
If bs.RecordCount = 0 Then
MsgBox "圖書編號不正確,請重新輸入", vbOKOnly, "信息提示"
Else
If bs.Fields("借否") = "借" Then
MsgBox "該圖書編號對應的圖書已借出,不能再借!", vbOKOnly, "信息提示"
Else
sqltxt = "select * from borrow"
Set brs = exesql(sqltxt)
brs.AddNew
brs.Fields("圖書編號") = bno
brs.Fields("書名") = bs.Fields("書名")
brs.Fields("作者") = bs.Fields("作者")
brs.Fields("出版社") = bs.Fields("出版社")
brs.Fields("借書證號") = rno
brs.Fields("姓名") = xm
brs.Fields("單位") = dw
brs.Fields("借書日期") = Date
brs.Update
bs.Fields("借否") = "借"
bs.Update
rs.Fields("已借書數") = rs.Fields("已借書數") + 1
rs.Update
End If
End If
End If
Label6.Caption = Str(rs.Fields("借書總數") - rs.Fields("已借書數"))
End Sub
Private Sub Form_Load()
Command2.Enabled = False
End Sub
Private Sub Frame3_DragDrop(Source As Control, X As Single, Y As Single)
Unload Me
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -