⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmbookborrowing_return.frm

📁 School Library system to manage students borrowing and returning books
💻 FRM
📖 第 1 页 / 共 2 页
字号:
         Caption         =   "ISBN"
         Height          =   255
         Left            =   240
         TabIndex        =   24
         Top             =   1680
         Width           =   1215
      End
      Begin VB.Label Label2 
         BackColor       =   &H80000000&
         Caption         =   "Book Name"
         Height          =   255
         Left            =   240
         TabIndex        =   23
         Top             =   960
         Width           =   1215
      End
      Begin VB.Label Label1 
         BackColor       =   &H80000000&
         Caption         =   "Date to Return"
         Height          =   255
         Index           =   3
         Left            =   240
         TabIndex        =   20
         Top             =   2400
         Width           =   1215
      End
      Begin VB.Label Label1 
         BackColor       =   &H80000000&
         Caption         =   "Date Borrowed"
         Height          =   255
         Index           =   2
         Left            =   240
         TabIndex        =   19
         Top             =   2040
         Width           =   1215
      End
      Begin VB.Label Label1 
         BackColor       =   &H80000000&
         Caption         =   "Book  ID"
         Height          =   255
         Index           =   1
         Left            =   240
         TabIndex        =   18
         Top             =   1320
         Width           =   1215
      End
   End
   Begin VB.Menu mnufile 
      Caption         =   "&File"
      Begin VB.Menu mnuReturn 
         Caption         =   "Return"
      End
      Begin VB.Menu mnuborrow 
         Caption         =   "&Borrow"
      End
      Begin VB.Menu mnuexit 
         Caption         =   "E&xit"
      End
      Begin VB.Menu mnureport 
         Caption         =   "&Report"
      End
   End
   Begin VB.Menu mnuedit 
      Caption         =   "&Edit"
      Begin VB.Menu mnumovenext 
         Caption         =   "Move &Next"
      End
      Begin VB.Menu mnuprevious 
         Caption         =   "Move &Previous"
      End
      Begin VB.Menu mnumovelast 
         Caption         =   "Move Last"
      End
      Begin VB.Menu mnumovefirst 
         Caption         =   "Move First"
      End
      Begin VB.Menu mnusearch 
         Caption         =   "Search"
      End
   End
   Begin VB.Menu mnulibrary 
      Caption         =   "Library"
      Begin VB.Menu mnuuserdetails 
         Caption         =   "User Details"
      End
      Begin VB.Menu mnubookdetails 
         Caption         =   "Book details"
      End
   End
   Begin VB.Menu mnuwindow 
      Caption         =   "&Window"
      Begin VB.Menu mnuhorizontal 
         Caption         =   "Tile Horizontal"
      End
      Begin VB.Menu mnuvertical 
         Caption         =   "Tile Vertical"
      End
   End
End
Attribute VB_Name = "frmbookborrowing_return"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim bookmark As String
Private Sub cmdborrow_Click()
'this loads the borrowing form so that one can
'borrow books that are available

frmborrowing.Show
Unload Me
End Sub

Private Sub cmdexit_Click()
'closes and unloads the these form from the memory
Unload Me
End Sub

Private Sub cmdnext_Click()
'calling the move next procedure for moving to the
'next record if available
movenext
End Sub

Private Sub cmdprev_Click()
'calling the move previous procedure for moving the
'pointer to the previous record if available
moveprevious
End Sub

Private Sub cmdreturn_Click()
'this loads the returning form so that one can
'return books that have been borrowed
Load frmreturning
frmreturning.Show
Unload Me
End Sub
Private Sub movenext()
'the move next procedure that moves the record
'pointer to the next record if there are other
'records
If datborrow_return.Recordset.EOF = True Then
datborrow_return.Recordset.MoveLast
MsgBox ("This is the last Record")
Else
datborrow_return.Recordset.movenext
If datborrow_return.Recordset.EOF = True Then
datborrow_return.Recordset.MoveLast
MsgBox ("This is The last Record")
     End If
End If
getstatus
End Sub
Private Sub moveprevious()
'the move Previous procedure that moves the record
'pointer to the Previous record if there is aprevious
'record
If datborrow_return.Recordset.BOF = True Then
datborrow_return.Recordset.MoveFirst
MsgBox ("This is the First Record")
Else
datborrow_return.Recordset.moveprevious
If datborrow_return.Recordset.BOF = True Then
datborrow_return.Recordset.MoveFirst
MsgBox ("This is The First Record")
     End If
End If
getstatus
End Sub

Private Sub cmdsearch_Click()
'searches through the record using the bookname as
'as its criteria, and storing the bookmark of the cuurent book
'and the bookmark is for returning the pointer to
'current position if the search is unsuccessiful
bookmark = txtbn.Text
'calling the search procedure that handles the search operation
search
End Sub
Private Sub Form_Activate()
'when form is activated the following is carried out
Dim countbook As Long, p As Integer
countbook = 0
'loops through the database and checks wether there
'are books that have been borrowed
Do While Not datborrow_return.Recordset.EOF
countbook = countbook + 1
datborrow_return.Recordset.movenext
Loop
'if there are no books borrowed then it will display
'a message and closes the for
If countbook = 0 Then
p = MsgBox("No Record for Books Borrowed", vbOKOnly + vbInformation, "Borrowed Books")
Unload frmbookborrowing_return
'else go to the first record and get the status
ElseIf countbook > 0 Then
datborrow_return.Recordset.MoveFirst
getstatus
End If
End Sub

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
'this is to display apopup menu equivalent the
'menu Library for the main form
Select Case Button
Case 2
PopupMenu mnulibrary
Case 1
End Select
End Sub

Private Sub frabookborrowed_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
'this is to display apopup menu equivalent the
'menu Library for the frame
Select Case Button
Case 2
PopupMenu mnulibrary
Case 1
End Select
End Sub

Private Sub mnuborrow_Click()
'equivalent to the command borrow that displays
'the borrowing form
frmborrowing.Show
End Sub

Private Sub mnuexit_Click()
'closes form
Unload Me
End Sub

Private Sub mnuhorizontal_Click()
'tiles the open forms horizontally
'mdilibrary.Arrange vbTileHorizontal
End Sub

Private Sub mnumovefirst_Click()
'moves to the first record
datborrow_return.Recordset.MoveFirst
End Sub

Private Sub mnumovelast_Click()
'moves to the last record
datborrow_return.Recordset.MoveLast
End Sub

Private Sub mnureport_Click()
'opens the report form for displaying some
'statistical data about the database
Load frmReport
frmReport.Show
End Sub

Private Sub mnuReturn_Click()
'equivalent to command borrow
frmreturning.Show
End Sub

Private Sub mnusearch_Click()
'equivalent to command Search
bookmark = txtbn.Text
search
End Sub

Private Sub mnuuserdetails_Click()
'opens the user details form for displaying user info.
frmuserparticulars.Show
End Sub
Private Sub mnuvertical_Click()
'tiles the open forms vertically
mdilibrary.Arrange vbTileVertical
End Sub
Private Sub mnumovenext_Click()
'equivalent to the command next >
movenext
End Sub

Private Sub mnuprevious_Click()
'equivalent to the command < Previous
moveprevious
End Sub
Private Sub mnubborrowing_Click()
'opens the borrowing form
frmbookborrowing_return.Show
End Sub

Private Sub mnubookdetails_Click()
'opens the bookdetails form for displaying book info
frmBookinfo.Show
End Sub
Private Sub search()
'search procedure for searching trough the DBase
Dim a, b, search
search = InputBox("The Borrowed Book Name", , "Search")
If Trim(search) <> "" Then
search = "bookname='" + search + "'"
datborrow_return.Recordset.FindFirst (search)
getstatus
Else
a = MsgBox("You must specify the book ID", vbInformation, "Book ID")
End If

If datborrow_return.Recordset.NoMatch Then
searching
b = MsgBox("There is no such Book Name", vbInformation, "Book ID")
End If
End Sub

Private Sub getstatus()
'unnecessary but used to get the status of the book e.g if borrowed
If datborrow_return.Recordset.Fields("borrowed") = "False" Then
lblbstatus = "Returned"
Else
lblbstatus = "Borrowed"
End If
End Sub

Private Sub searching()
'if search is unsuccessiful the pointer is moved to
'the initial positions before the search was called
Dim a, b, find
datborrow_return.Recordset.MoveFirst
find = bookmark
If Trim(find) <> "" Then
find = "bookname='" + find + "'"
datborrow_return.Recordset.FindFirst find
End If
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -