?? frmbrwnextedit.frm
字號:
VERSION 5.00
Begin VB.Form frmBrwNextEdit
BackColor = &H00C0C0C0&
Caption = "借閱編輯步驟二"
ClientHeight = 6630
ClientLeft = 5025
ClientTop = 3015
ClientWidth = 8160
LinkTopic = "Form1"
ScaleHeight = 6630
ScaleWidth = 8160
Begin VB.CommandButton cmdCancel
Caption = "取消(&C)"
Height = 615
Left = 5040
TabIndex = 3
Top = 5760
Width = 1335
End
Begin VB.CommandButton cmdOk
Caption = "生成信息(&G)"
Height = 615
Left = 3120
TabIndex = 2
Top = 5760
Width = 1335
End
Begin VB.Frame Frame2
BackColor = &H00C0C0C0&
Caption = "步驟二:填寫圖書信息"
Height = 2535
Left = 480
TabIndex = 1
Top = 2880
Width = 7095
Begin VB.TextBox txtTypeName
Height = 495
Left = 4800
TabIndex = 23
Top = 1680
Width = 2055
End
Begin VB.TextBox txtPrice
Height = 495
Left = 1320
TabIndex = 22
Top = 1680
Width = 2175
End
Begin VB.TextBox txtPublisher
Height = 495
Left = 4800
TabIndex = 21
Top = 960
Width = 1935
End
Begin VB.TextBox txtAuthor
Height = 495
Left = 1320
TabIndex = 20
Top = 960
Width = 2175
End
Begin VB.TextBox txtBName
Height = 495
Left = 4800
TabIndex = 19
Top = 240
Width = 1935
End
Begin VB.TextBox txtBNo
Height = 495
Left = 1320
TabIndex = 12
Top = 240
Width = 2175
End
Begin VB.Label Label10
BackStyle = 0 'Transparent
Caption = "所屬類別"
Height = 375
Left = 3960
TabIndex = 18
Top = 1800
Width = 735
End
Begin VB.Label Label9
BackStyle = 0 'Transparent
Caption = "價格"
Height = 495
Left = 240
TabIndex = 17
Top = 1680
Width = 855
End
Begin VB.Label Label8
BackStyle = 0 'Transparent
Caption = "出版社"
Height = 375
Left = 3960
TabIndex = 16
Top = 1080
Width = 735
End
Begin VB.Label Label7
BackStyle = 0 'Transparent
Caption = "圖書作者"
Height = 375
Left = 240
TabIndex = 15
Top = 960
Width = 855
End
Begin VB.Label Label6
BackStyle = 0 'Transparent
Caption = "圖書名稱"
Height = 375
Left = 3960
TabIndex = 14
Top = 360
Width = 975
End
Begin VB.Label Label5
BackStyle = 0 'Transparent
Caption = "圖書編號"
Height = 375
Left = 240
TabIndex = 13
Top = 360
Width = 975
End
End
Begin VB.Frame Frame1
BackColor = &H00C0C0C0&
Caption = "借閱信息"
Height = 2055
Left = 480
TabIndex = 0
Top = 360
Width = 7095
Begin VB.TextBox txtReturnDate
Height = 495
Left = 4920
TabIndex = 11
Top = 1200
Width = 1815
End
Begin VB.TextBox txtBorrowDate
Height = 495
Left = 1440
TabIndex = 10
Top = 1200
Width = 2175
End
Begin VB.TextBox txtReader
Height = 495
Left = 4920
TabIndex = 9
Top = 360
Width = 1815
End
Begin VB.TextBox txtCNo
Height = 495
Left = 1440
TabIndex = 8
Top = 360
Width = 2175
End
Begin VB.Label Label4
BackStyle = 0 'Transparent
Caption = "應(yīng)歸還日期"
Height = 495
Left = 3840
TabIndex = 7
Top = 1320
Width = 975
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "借閱日期"
Height = 615
Left = 240
TabIndex = 6
Top = 1200
Width = 1335
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "姓名"
Height = 495
Left = 3960
TabIndex = 5
Top = 480
Width = 735
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "借閱證號"
Height = 495
Left = 240
TabIndex = 4
Top = 360
Width = 1095
End
End
End
Attribute VB_Name = "frmBrwNextEdit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rs As ADODB.Recordset
Dim SQLStr As String
' 返回按鈕
Private Sub cmdCancel_Click()
Unload Me
End Sub
'生成信息/確定按鈕
Private Sub cmdOk_Click()
'生成信息
If Left(cmdOk.Caption, 4) = "生成信息" Then
'判斷框的有效性
If Trim(txtBNo.Text) = "" Then
MsgBox "輸入的圖書編號為空", vbInformation, "生成信息"
txtBNo.SetFocus
Exit Sub
End If
'判斷是否存在此圖書編號
SQLStr = "select * from BookInfo where BookNo='" + Trim(txtBNo) + "'"
Set rs = SQLQuery(SQLStr)
If rs.EOF Then
MsgBox "無此借閱證號,請輸入正確的圖書編號", vbInformation, "生成信息"
txtBNo.SetFocus
txtBNo.SelStart = 0
txtBNo.SelLength = Len(txtBNo.Text)
Exit Sub
End If
'確認此借閱證號為正確的
If MsgBox("是否借閱此編號的圖書?" + vbCrLf + "生成其他信息后,圖書編號將不能被修改", vbQuestion + vbYesNo + vbDefaultButton1, "詢問") = vbNo Then
Exit Sub
End If
'對控件屬性進行修改
txtBNo.Enabled = False
txtBName.Text = Trim(rs.Fields("BookName"))
txtAuthor.Text = Trim(rs.Fields("Author"))
txtPublisher.Text = Trim(rs.Fields("Publisher"))
txtPrice.Text = Trim(Str(rs.Fields("Price")))
Dim rst As ADODB.Recordset
SQLStr = "select * from BookType where TypeID=" + Trim(rs.Fields("TypeID"))
Set rst = SQLQuery(SQLStr)
txtTypeName.Text = Trim(rst.Fields("typename"))
cmdOk.Caption = "確定(&O)"
'當"生成信息"后,"生成信息"按鈕的Caption屬性修改為"確定",以下是"確定"代碼
Else
'判斷此書籍是否已經(jīng)被借出
SQLStr = "select * from BorrowInfo where BookNo='" + Trim(txtBNo) + "'"
Set rs = SQLQuery(SQLStr)
If Not rs.EOF Then
'如果沒查詢到此圖書編號,表明沒有借出此書
'如果查詢到此圖書編號,表明已經(jīng)借出此書
MsgBox "此書已經(jīng)借出,借書操作失敗", vbInformation, "生成信息"
Unload Me
Exit Sub
End If
SQLStr = "insert into BorrowInfo(CardNo,BookNo,BorrowDate,ReturnDate,BorrowState) values('" + Trim(txtCNo) + "','" + Trim(txtBNo) + "','" + Format(txtBorrowDate, "yyyy-mm-dd") + "','" + Format(txtReturnDate, "yyyy-mm-dd") + "'," + Trim(Str(0)) + ")"
SQLExt SQLStr '執(zhí)行insert 語句
MsgBox "借閱成功", vbInformation, "借閱信息"
Unload Me '關(guān)閉窗口
End If
End Sub
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -