?? frmreturn.frm
字號:
VERSION 5.00
Begin VB.Form frmReturn
BorderStyle = 3 'Fixed Dialog
Caption = "還書"
ClientHeight = 4200
ClientLeft = 45
ClientTop = 330
ClientWidth = 7380
Icon = "frmReturn.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
Picture = "frmReturn.frx":0442
ScaleHeight = 4200
ScaleWidth = 7380
ShowInTaskbar = 0 'False
Begin VB.CommandButton cmdExit
Caption = "退出(&X)"
BeginProperty Font
Name = "宋體"
Size = 11.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 6000
TabIndex = 13
Top = 3540
Width = 1215
End
Begin VB.Frame Frame1
Caption = "借閱人"
BeginProperty Font
Name = "宋體"
Size = 11.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 855
Left = 120
TabIndex = 6
Top = 60
Width = 6735
Begin VB.TextBox txtPName
Enabled = 0 'False
BeginProperty Font
Name = "宋體"
Size = 11.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 2640
TabIndex = 9
Top = 240
Width = 975
End
Begin VB.TextBox txtDepartment
Enabled = 0 'False
BeginProperty Font
Name = "宋體"
Size = 11.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 4560
TabIndex = 8
Top = 240
Width = 1815
End
Begin VB.TextBox txtPNo
BeginProperty Font
Name = "宋體"
Size = 11.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 720
TabIndex = 7
Top = 240
Width = 1215
End
Begin VB.Label Label2
Caption = "編號:"
BeginProperty Font
Name = "宋體"
Size = 11.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 120
TabIndex = 12
Top = 360
Width = 1215
End
Begin VB.Label Label3
Caption = "姓名:"
BeginProperty Font
Name = "宋體"
Size = 11.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 2040
TabIndex = 11
Top = 360
Width = 1215
End
Begin VB.Label Label4
Caption = "部門:"
BeginProperty Font
Name = "宋體"
Size = 11.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 3960
TabIndex = 10
Top = 360
Width = 1215
End
End
Begin VB.Frame Frame2
Caption = "還書"
BeginProperty Font
Name = "宋體"
Size = 11.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 2295
Left = 120
TabIndex = 2
Top = 960
Width = 7095
Begin VB.TextBox txtDate
Enabled = 0 'False
BeginProperty Font
Name = "宋體"
Size = 11.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1320
TabIndex = 17
Top = 1680
Width = 1575
End
Begin VB.TextBox txtBName
Enabled = 0 'False
BeginProperty Font
Name = "宋體"
Size = 11.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 840
TabIndex = 15
Top = 1260
Width = 2055
End
Begin VB.ListBox lstBorrow
BeginProperty Font
Name = "宋體"
Size = 11.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 960
ItemData = "frmReturn.frx":0884
Left = 360
List = "frmReturn.frx":0886
TabIndex = 14
Top = 240
Width = 2535
End
Begin VB.ListBox lstBook
BeginProperty Font
Name = "宋體"
Size = 11.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 1860
ItemData = "frmReturn.frx":0888
Left = 3240
List = "frmReturn.frx":088A
TabIndex = 5
Top = 240
Width = 2295
End
Begin VB.CommandButton cmdAdd
Caption = "添加(&A)"
BeginProperty Font
Name = "宋體"
Size = 11.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 5640
TabIndex = 4
Top = 600
Width = 1215
End
Begin VB.CommandButton cmdDelete
Caption = "刪除(&D)"
BeginProperty Font
Name = "宋體"
Size = 11.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 5640
TabIndex = 3
Top = 1200
Width = 1215
End
Begin VB.Label Label1
Caption = "借閱時間:"
BeginProperty Font
Name = "宋體"
Size = 11.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 240
TabIndex = 18
Top = 1740
Width = 1215
End
Begin VB.Label Label6
Caption = "書名:"
BeginProperty Font
Name = "宋體"
Size = 11.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 240
TabIndex = 16
Top = 1320
Width = 1215
End
End
Begin VB.CommandButton cmdOK
Caption = "確認(&O)"
BeginProperty Font
Name = "宋體"
Size = 11.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 3360
TabIndex = 1
Top = 3540
Width = 1215
End
Begin VB.CommandButton cmdCancel
Caption = "取消(&C)"
BeginProperty Font
Name = "宋體"
Size = 11.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 4680
TabIndex = 0
Top = 3540
Width = 1215
End
End
Attribute VB_Name = "frmReturn"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim cnn As New ADODB.Connection
Dim rst As New ADODB.Recordset
Private Sub cmdAdd_Click()
Dim BookNo As String
BookNo = lstBorrow.List(lstBorrow.ListIndex)
For i = 0 To lstBook.ListCount - 1
If lstBook.List(i) = BookNo Then
MsgBox "該書已經被歸還", , "信息"
lstBorrow.SetFocus
Exit Sub
End If
Next
lstBook.AddItem BookNo
lstBorrow.SetFocus
End Sub
Private Sub cmdDelete_Click()
If lstBook.ListCount > 0 Then
lstBook.ListIndex = 0
Else
Exit Sub
End If
lstBook.RemoveItem lstBook.ListIndex
txtPNo.SetFocus
End Sub
Private Sub cmdExit_Click()
Unload Me
End Sub
Private Sub cmdOK_Click()
Dim pstr As String, cnnstr As String
pstr = "update borrow set [to] = #" & Date & "# where [PNo] = '" & txtPNo.Text & "' and [BNo]='"
For i = 0 To lstBook.ListCount - 1
cnnstr = pstr & lstBook.List(i) & "'"
cnn.Execute cnnstr
Next
End Sub
Private Sub Form_Load()
Me.Move (frmMain.ScaleWidth - Me.Width) / 2, (frmMain.ScaleHeight - Me.Height) / 2
Dim strcnn As String
strcnn = "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;Data Source=" & App.Path & "\BookManage.mdb"
cnn.Open (strcnn)
End Sub
Private Sub Form_Unload(Cancel As Integer)
cnn.Close
End Sub
Private Sub lstBorrow_Click()
Dim rststr As String, BNo As String
BNo = lstBorrow.List(lstBorrow.ListIndex)
'從Book表中查找記錄
rststr = "select [Name] from Book where [No]='" & BNo & "'"
rst.Open rststr, cnn, adOpenKeyset, adLockOptimistic, adCmdText
txtBName.Text = rst![Name]
'從Borrow表中查找記錄
rst.Close
rststr = "select [From] from Borrow where [PNo]='" & txtPNo.Text & "' and [BNo]='" & BNo & "'"
rst.Open rststr, cnn, adOpenKeyset, adLockOptimistic, adCmdText
txtDate.Text = rst![From]
rst.Close
End Sub
Private Sub txtPNo_LostFocus()
If txtPNo.Text = "" Then Exit Sub
Dim rststr As String
'從Person表中查找記錄
rststr = "select * from Person where [No]='" & txtPNo.Text & "'"
rst.Open rststr, cnn, adOpenKeyset, adLockOptimistic, adCmdText
If rst.RecordCount < 1 Then
MsgBox "未找到記錄,請重新輸入。", , "信息"
txtPNo.SetFocus
rst.Close
Exit Sub
End If
txtPName.Text = rst!Name
txtDepartment.Text = rst!Department
rst.Close
'從Borrow表中查找記錄
rststr = "select * from Borrow where [PNo]='" & txtPNo.Text & "' and [to]=Null"
rst.Open rststr, cnn, adOpenKeyset, adLockOptimistic, adCmdText
If rst.RecordCount < 1 Then
MsgBox "沒有借閱圖書,請重新輸入。", , "信息"
txtPNo.SetFocus
rst.Close
Exit Sub
End If
Dim i As Integer
lstBorrow.Clear
For i = 1 To rst.RecordCount
lstBorrow.AddItem rst!BNo
rst.MoveNext
Next
rst.Close
lstBorrow.ListIndex = 0
lstBorrow_Click
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -