Documentation (Project Neha)

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 151

For

Three Year Engineering

Diploma

LMS ©Neha Chauhan 1 SBOTE – Branch Computer


Dedicated

To All Those

Who Supported Me !!!

LMS ©Neha Chauhan 2 SBOTE – Branch Computer


Table of Content
Student Profile ................................................................................................................-4-
Acknowledgement...........................................5…
Acknowledgement.
Certificate…………………………………………………………………………………………………
……………………….6…
Certificate from Project Guide......................................................................................- 5 -
Certificate from HOD....................................................................................................- 5 -
Objective....................................................................................................................... - 5 -
Introduction........................................................................Error! Bookmark not defined.
System Requirement…………………………………..……………………………………….....-11....
Project Analysis..................................................................Error! Bookmark not defined.
DFD..............................................................................................................................- 12 -
E-R Diagram................................................................................................................- 14 -
Coding & Screening.....................................................................................................- 20 -
Progressing Screen......................................................................................................- 22 -
Password Screen.................................................................Error! Bookmark not defined.
Splash Screen......................................................................Error! Bookmark not defined.
MDI..............................................................................................................................-38-X
Add Book Form.............................................................................................................- 36 -
Update Book...................................................................................................................-52I
Search Book.......................................................................-Error! Bookmark not defined.
Delete Book.........................................................................Error! Bookmark not defined.
Add Member......................................................................-Error! Bookmark not defined.
Update Member.............................................................-75Error! Bookmark not defined.
Delete Member....................................................................Error! Bookmark not defined.
Issue Book...........................................................................Error! Bookmark not defined.
Return Book.......................................................................-Error! Bookmark not defined.
Generate Report.................................................................-Error! Bookmark not defined.
Book Report............................................................................................................ -113-C-
Student Report....................................................................Error! Bookmark not defined.
Daily Report........................................................................Error! Bookmark not defined.
Issued Book Report................................................................Error! Bookmark not defined.

Bibliography………………………………………………………………………………………………
…….-121-
Thank you……… ………………………………………………………………..
…………………………….-122-

LMS ©Neha Chauhan 3 SBOTE – Branch Computer


Student Profile

Name : Neha Chauhan


Rgt. Number : 0130/ C/ 07
Course Title : Three Year
Engineering
Diploma In
Computer Science
Semester : 6th
College Name : KITE Polytechnic.
Address of College : Rangreth,
Srinagar,(J&K)

LMS ©Neha Chauhan 4 SBOTE – Branch Computer


Acknowledgement
The making of this project has been an insightful endeavor
and an enriching experience. The completion of this project
would have not been possible, had it not been for the
generous help and constant guidance of my mentors.
I express my deep sense of gratitude to my most
respected Program-Incharge Miss Manjeet Kaur for her
continuous motivation, benevolent and helping attitude as
well as for her invaluable, substantive ideas and noble
encouragement without which this project would not have
come into existence.
I express my gratitude and humble regards to Mr
Khalil Abnan for his invaluable guidance in developing
‘Library Management System Project’. I also express my
heartfelt thanks to my compatriots for their constructive
suggestions.
Lastly, I also express my gratitude to all the well-wishers
associated with this project whose names don’t appear here.

Neha Chauhan

LMS ©Neha Chauhan 5 SBOTE – Branch Computer


Certificate

This is to certify that the project COMPUTERIZED LIBRARY


MANAGEMENT SYSTEM of KITE College with Security option
is an appreciable work carried out by Miss. NEHA CHAUHAN
and is submitted to STATE BOARD OF TECHNICAL
EDUCATION towards fulfillment of the requirement for the
award of the Thre Year Engineering Diploma of COMPUTER
SCIENCE under the Guidance of Mr. Khalil Abnan.

Signature & Seal of the Principal

KITE Polytechnic College

LMS ©Neha Chauhan 6 SBOTE – Branch Computer


Certificate From Project Guide
This is to certify that the project Library Management System submitted
to SBOTE (State Board Of Technical Education) towards fulfillment of
the requirement for the award of the Three Year Engineering Diploma in
Computer Science is an original work carried out by Miss. Neha
Chauhan bearing Registration No. 0130/ C/ 07 under my Guidance.
The matter embodied in this Project is a genuine work done by the
Student and has not been submitted whether to this College/ Institute for
the fulfilment of the requirement of any course of study.

Signature of the Guide


Mr. Khalil Abnan

Certificate From HOD

(Head Of Department)

LMS ©Neha Chauhan 7 SBOTE – Branch Computer


This is to certify that the project Library Management System
submitted to SBOTE (State Board Of Technical Education) towards
fulfillment of the requirement for the award of the Three Year
Engineering Diploma in Computer Science is an original work carried
out by Miss. Neha Chauhan bearing Registration No. 0130/ C/ 07 under
the Guidance of Mr.Khalil Abnan.

I wish Her good Luck for Her future.

Signature of the HOD


Miss. Manjeet Kour

LMS ©Neha Chauhan 8 SBOTE – Branch Computer


Objectives

The project is aimed at developing software to computerize a

Library Management System with password protection. The

concept of computer managed library is not only the need of the

hour but also a very appealing idea. The computerization

eliminates enormous duplication. The system proposed in this

project report is specially designed for this very purpose. The

essence of this project lies in the ease with which it can be

implemented and the unexpected relief and pleasure is given to

the user.

LMS ©Neha Chauhan 9 SBOTE – Branch Computer


Overall is it’s facility of protection with which not everyone

can access it. The database developed by me will hopefully

eliminate all the drawbacks of the manual system besides

accelerating the pace of usual day to day activities performed in a

library and the most important of all, the proposal system is user

friendly and easy to use.

Every item of useful information about the working of a

library is stored in the memory of a computer, always ready to be

utilized whenever needed and all this will result in an enhanced

working performance. In short the proposed system is flexible

information system i.e. a system is efficient, faster, user-friendly,

accurate, automatic and reliable.

Introduction
The computerization of the information regarding number of
members, members name, address, member-id, number of

LMS ©Neha Chauhan 10 SBOTE – Branch Computer


books available in library, date of issue, date of return, member
details etc are readily available by adopting this process of
management of library. And security is a brilliant step towards
its ill use. A traditional or manual librarian can proudly assert
himself to be modern library worker. The most important
advantage of this management is that there is lots of reductions
in time duration for choosing, issuing a book, return of a book,
checking authentic members, availability of books. Moreover
the records of the members can be easily updated without any
loss of time in

respect of modification of library which a frequent phenomenon


is considering the tremendous revolution in information
technology. The programming designed in this management of
the library data is quite easy to understand and even layman
with a little effort can understand and use this package.

LMS ©Neha Chauhan 11 SBOTE – Branch Computer


LMS ©Neha Chauhan 12 SBOTE – Branch Computer
System Requirement

Hardware Requirements

Processor : 2.9 GHz.

Minimum RAM : 128 MB/ 1GB.

Secondary Storage : Hard Disk (3GB).

Input/Output Devices: Monitor,Keyboard

& Printer.

Software Requirements

Operating System : MS Windows XP

LMS ©Neha Chauhan 13 SBOTE – Branch Computer


Language : VB.Net Database : MS

Access

LMS ©Neha Chauhan 14 SBOTE – Branch Computer


Project Analysis
The basic aim of Analysis is to obtain a clear understanding of
problem under consideration. I have tried my best to collect all
the informative data concerned with this project. I tried my best
to visit libraries from where I could gain information and
interacted with concerned people to get a clear understanding of
the problem.

Introduction to Problem
Providing quick and efficient services to the library user is the
basis of the problem and this can be achieved by a library worker
at present after sweating over the rigorous tasks of proper
maintenance and upkeep of the library records, updating of the
records for new arrivals and other miner details. Even if

LMS ©Neha Chauhan 15 SBOTE – Branch Computer


utmost care is taken in these essential activities certain
discrepancies do creep in due to error prone human mind.
Moreover, without complete computerization and storage of
data, the problem of keeping new arrivals in any branch of
knowledge becomes almost impossible.

It is therefore imperative that the problem realization in library

services and for that matter in any other type of public services

be given the first attention.

This project work aims at this aspect with care. Realization of all
the attendant problems has made it possible to bring light the
concept of computerization of library services.

To design the system described in this project report the modular

approach has

LMS ©Neha Chauhan 16 SBOTE – Branch Computer


been opted for because the modular approach makes a system

easy to design and understand.

Present System Libraries


Presently in most of libraries work is being done manually
which takes a lot of time e.g.; cataloging books, keeping records
of books, issuing books, calculating fine etc . A lot of time is
being consumed for doing even a small kind of work. Some times
the library staff member keeps a book out of the required order
which causes a lot of problem to both the issuing authority and
the persons who need a book. Some times one has to go through
the dusty records kept some where in a dark corner of a library.
All these factors contribute to inefficiency and mismanagement of
services which is provided

by a library to readers who need a better and efficient


management of services.

LMS ©Neha Chauhan 17 SBOTE – Branch Computer


LMS ©Neha Chauhan 18 SBOTE – Branch Computer
Proposed System
To over come all these problems I made every possible attempt
and rather developed a project for this, which is user friendly,
easy to maintain and mostly searching a particular record is easy
the data are stored for long time which is the advantage of this
project it is fully computerized, portable and user friendly and
that too with security system. The concept of computer managed
library is not only the need of the hour but also a very appealing
idea. The computerization eliminates enormous duplication. The
system proposed in this project report is specially designed for
this very purpose. The essence of this project lies in the ease with
which it can be implemented and the unexpected relief and
pleasure is given to the user.

LMS ©Neha Chauhan 19 SBOTE – Branch Computer


The database developed by me will hopefully eliminate all
the drawbacks of the manual system besides accelerating the
pace of usual day to day activities performed in a library and the
most important of all, the proposal system is user friendly and
easy to use.

The ease of adoption and quick retrieval of information is


the essential feature of this package developed for adoption. The
novelty of the proposed package lies in the following important
characteristics of the work:

1. It is user friendly i.e., any person can easily handle it without


any knowledge of hardware or software specification.
2. It has been developed in interactive mode i.e., just by giving a
few commands; the user can have access to the operation of
the package. In this

way the user can easily and conveniently communicate with


the system and work with it.
3. It has been developed under front end as “VB” and “MS-
ACCESS” as backend, both of them are highly

LMS ©Neha Chauhan 20 SBOTE – Branch Computer


Portable, reliable, simple and easy to use.

LMS ©Neha Chauhan 21 SBOTE – Branch Computer


Environment Used
Microsoft Windows Environment:

Most of the systems today uses this type of environment or

operating systems in their computer. Because it is easy to use

and support Graphical User Interface. This project was also

made on Windows operating system.

LMS ©Neha Chauhan 22 SBOTE – Branch Computer


Language and Database Used
Language Used

The increasing popularity of “VB” is probably due to its many

desirable qualities. It is a robust language whose rich set of built

in function and operators can be used to write any complex

program. The “VB” is a high level language and is well suited for

writing business packages.

As there are many languages present in the market. So we took

as this language is GUI (Graphical User Interface). The

availability of controls in this language has tremendous

properties by which I made my project user friendly and good

looking.

LMS ©Neha Chauhan 23 SBOTE – Branch Computer


The data entry is easy with lot of choices. Visual basic .Net is a

powerful programming language to develop sophisticated

windows programs very quickly. VB.Net is one of the RAD

(Rapid Application Development tools) as it enables the

programmer to develop applications very easily and quickly.

Another important feature of “VB.Net” is its ability to extend

itself. A “VB.Net” program is basically a collection of Event

Procedures. With the availability of large number of functions

the programming task becomes simple. Programs written in

“VB” are efficient and fast. This is due to its variety of data types

and powerful

operators. It is many times faster than BASIC.

LMS ©Neha Chauhan 24 SBOTE – Branch Computer


Database Used (Access)
MS-Access is a RDBMS under windows. It is used to store and

manipulate large amount of data. The data is stored in multiple

tables and access allows us to set up relationships between the

tables to facilitate data retrieval.

MS-Access is an object oriented program i.e. every thing in MS-

Access is an object. Each object has a property that defines how

it appears and what work it performs. MS-Access has a number

of components out of which the most important is the table

object. Tables are objects that hold the data and all related

objects such as queries, forms and reports that are used to

manage this data in tables.

LMS ©Neha Chauhan 25 SBOTE – Branch Computer


The main features of MS-Access are:

o Create data tables and store data in them.

o Edit data records.

o Retrieve data records.

o Perform calculations

LMS ©Neha Chauhan 26 SBOTE – Branch Computer


DFD (Data Flow Diagram)

Book Issue Return


Request
Fine Library
Member Student
Managemen
ACK ACK t
System

Membership Request 0.0

Non-Member
Student
Request Accepted or Rejected

LMS ©Neha Chauhan 27 SBOTE – Branch Computer


Top Level DFD

LMS ©Neha Chauhan 28 SBOTE – Branch Computer


Book Issue / Return
Request

Member Student Search


Info
Membership
-ve
ACK Checking
Process
Member Student
Data Store
1.1

Valid Member
Info
Info
Search /
Book Issue & Update
+ve /
-ve Return
ACK Process
Book Data Store
1.2

Fine Details

Update

Account
Fine
Maintaining
Process

1.3 Accounts Data


ACK Store

LMS ©Neha Chauhan 29 SBOTE – Branch Computer


E-R Diagram (Entity

Relationship)

LMS ©Neha Chauhan 30 SBOTE – Branch Computer


Non-Member Is
Student
Registered
As

Member ID
Name
Address
Ph.no
e-mail
add.
Member
Student

Pays
Issued
Returned To
By

Book ID
Title
Category
Fi n e Price
Amoun
t Copies
Books

LMS ©Neha Chauhan 31 SBOTE – Branch Computer


Coding and Screening

Coding will go according to the sequential


access of the project.

LMS ©Neha Chauhan 32 SBOTE – Branch Computer


Progressing Screen

LMS ©Neha Chauhan 33 SBOTE – Branch Computer


'This is first form that is displayed when the project is
run.
‘This module displays the title of the project and shows
the ‘progressing of the loading method.

LMS ©Neha Chauhan 34 SBOTE – Branch Computer


Private Sub Timer1_Timer()
Static s As Integer
If s < 1 Then
lblload.Caption = "Loading.........."

s = s + 1
ElseIf s < 2 Then
lblload.Caption = "Loading StartScreen........"

s = s + 1
ElseIf s < 3 Then
lblload.Caption = "Loading AddBooksForm............"

s = s + 1
ElseIf s < 4 Then
lblload.Caption = "Loading DeleteBooksForm............."

s = s + 1

LMS ©Neha Chauhan 35 SBOTE – Branch Computer


ElseIf s < 5 Then
lblload.Caption = "Loading
UpdateBooksForm................"

s = s + 1
Else If s < 6 Then
lblload.Caption = "Loading IssueBookForm.............."

s = s + 1
Else If s < 7 Then
lblload.Caption = "Loading Report.............."

s = s + 1
Else If s < 8 Then

lblload.text = "Loading Search Form..........."

s = s + 1
Else If s < 9 Then

LMS ©Neha Chauhan 36 SBOTE – Branch Computer


lblload.text = "Loading Splash screen............"

s = 0
End If
End Sub

Private Sub Timer2_Timer ()


On Error Go To Myer:
PB1.Value = PB1.Value + 10
If PB1.Value >= 100 Then
Timer2.Enabled = False
PB1.Visible = False
PB1.Value = 0
frmSplash.Show
Unload frmload
Exit Sub

Myer:
MsgBox "ERROR:" & Err. Description, , "Progress
Bar"

LMS ©Neha Chauhan 37 SBOTE – Branch Computer


Exit Sub
End If
End Sub

Private Sub Timer3_Timer ()


Static c as Integer
If c < 1 Then
Label1.ForeColor = RGB (250, 250, 0)
Label2.ForeColor = RGB (150, 150, 50)
Label3.ForeColor = RGB (150, 0, 250)

c = c + 1
Else If c < 2 Then
Label1.ForeColor = RGB (0, 0, 250)
Label2.ForeColor = RGB (0, 250, 250)
Label3.ForeColor = RGB (200, 50, 0)

c = c + 1
Else If c < 3 Then

LMS ©Neha Chauhan 38 SBOTE – Branch Computer


Label1.ForeColor = RGB (0, 250, 0)
Label2.ForeColor = RGB (30, 0, 90)
Label3.ForeColor = RGB (250, 0, 0)

c = c + 1
Else If c < 4 Then
Label1.ForeColor = RGB (0, 0, 0)
Label2.ForeColor = RGB (30, 90, 0)
Label3.ForeColor = RGB (25, 300, 0)

c = c + 1
Else If c < 5 Then
Label1.ForeColor = RGB (0, 0, 0)
Label2.ForeColor = RGB (0, 0, 0)
Label3.ForeColor = RGB (0, 3, 0)

c = c + 1
Else If c < 6 Then
Label1.ForeColor = RGB (200, 0, 300)
Label2.ForeColor = RGB (0, 300, 300)
Label3.ForeColor = RGB (300, 300, 0)

LMS ©Neha Chauhan 39 SBOTE – Branch Computer


c = 0
End If
End Sub

LMS ©Neha Chauhan 40 SBOTE – Branch Computer


Password Screen
Or
Autrhentication Screen

LMS ©Neha Chauhan 41 SBOTE – Branch Computer


LMS ©Neha Chauhan 42 SBOTE – Branch Computer
LMS ©Neha Chauhan 43 SBOTE – Branch Computer
Option Explicit
'Declaring the variables
Public Login Succeeded As Boolean
Public pad As String
Public user As String
Private Sub cmdcancel_Click ()
Login Succeeded = False
Me. Hide
End Sub

Private Sub cmdok_Click ()


'Confirming the username and password
Data1.Recordset.FindFirst "USERNAME= '" &
txtusername.Text & "' and PASSWORD= '" & txtpassword.Text
& "'"
If Data1.Recordset.NoMatch = False Then
frmSplash.Show
Unload Me
Me. Hide

LMS ©Neha Chauhan 44 SBOTE – Branch Computer


Else

'if no match found then display message


MsgBox "Invalid Password or username, try again!", ,
"Login"
txtpassword.SetFocus
Send Keys "{Home}+{End}"
End If
End Sub

Private Sub Form Load ()


Data1.DatabaseName = App. Path & "\LIB.mdb"
Data1.RecordSource = "PWD"
Data1.Refresh
End Sub

LMS ©Neha Chauhan 45 SBOTE – Branch Computer


Splash Screen

LMS ©Neha Chauhan 46 SBOTE – Branch Computer


LMS ©Neha Chauhan 47 SBOTE – Branch Computer
'This is the second form that is displayed when the
project is ‘run. This module only displays the title of
the project and ‘does not perform any special task.
Option Explicit

‘Press any key to unload splash screen and show MDI


form ‘or wait ‘for 2 seconds.
Private Sub Form_KeyPress (Key ASCII as Integer)
mdiStart.Show
Unload Me
End Sub

Private Sub Form Load ()


Label1.Left = Me.ScaleWidth / 3

LMS ©Neha Chauhan 48 SBOTE – Branch Computer


Label1.Caption = vocal & vocal & “LIBRARY
MANAGEMENT SYSTEM" & vbCrLf & vocal & "
DESIGNED AND

DEVELOPED" & vbCrLf & vbCrLf & "


BY" & vbCrLf & vbCrLf & " Samara" &
vbCrLf & vbCrLf & " Guided by Asia Mustafa"
End Sub

Private Sub Timer1_Timer ()


mdiStart.Show
Unload Me
End Sub
'==========================================

‘Declaring variables

Public con As Connection

Public com As Command

LMS ©Neha Chauhan 49 SBOTE – Branch Computer


'==========================================

'This is a module and is used for making a connect ()

function ‘that

makes a connection with database. This connects ()

‘function is then used in other forms to make

connection with ‘database.

Public Sub Connect ()

Set con = New Connection

Set com = New Command

With con

.Connection String = "user id=Admin; Data

Source=" & App. Path & "\LIB.mdb"

LMS ©Neha Chauhan 50 SBOTE – Branch Computer


.Provider = "Microsoft.Jet.OLEDB.3.51"

.Open

End With

com.ActiveConnection = con

End Sub

LMS ©Neha Chauhan 51 SBOTE – Branch Computer


Main Form Code (MDI)
Or
Main Data Interface

LMS ©Neha Chauhan 52 SBOTE – Branch Computer


LMS ©Neha Chauhan 53 SBOTE – Branch Computer
'This project is made to computerize the library management

‘system so that the overall functioning of a library would get

‘enhanced. It contains different modules like Add book (to ‘add a

new book), Delete book (to delete book), Update ‘book (to update

the information regarding a book).

'Add Student (to add new member), Update Student (to search

‘and update the information of an existing Student) Delete

‘Student (to delete an existing), Search book (to see the

‘information about any book)

LMS ©Neha Chauhan 54 SBOTE – Branch Computer


'Issue book (to issue a book to a member), Return book (to

‘return a book from a Student)

'It also contains reports like Member report (to show details ‘of

members), Books report (to show the details of the

'Books present in the library, Daily report (to show information

‘about daily transactions taking place in the library).

‘MDI form containing menus

'Declaring events for all menus on MDI form

Private Sub mnuDel_Click()

Load fumbled

mnuDel.Enabled = False

End Sub

Private Sub mnuDel2_Click ()

LMS ©Neha Chauhan 55 SBOTE – Branch Computer


Load remodel

mnuDel2.Enabled = False

End Sub

Private Sub mnuExit2_Click ()

End

End Sub

Private Sub mnuNew_Click ()

Load frmBAdd

mnuNew.Enabled = False

End Sub

Private Sub mnuNew2_Click()

Load frmCAdd

mnuNew2.Enabled = False

End Sub

LMS ©Neha Chauhan 56 SBOTE – Branch Computer


Private Sub mnuRent1_Click ()

frmRent.Show

mnuRent1.Enabled = False

End Sub

Private Sub mnurep2_Click ()

frmReport.Show

mnurep2.Enabled = False

End Sub

Private Sub mnuRet2_Click ()

frmRet.Show

mnuRet2.Enabled = False

End Sub

Private Sub mnuUpd_Click ()

Load frmBUpd

LMS ©Neha Chauhan 57 SBOTE – Branch Computer


mnuUpd.Enabled = False

End Sub

Private Sub mnuUpd2_Click ()

Load forced

mnuUpd2.Enabled = False

End Sub

Private Sub ser_Click ()

frmser.Show

ser.Enabled = False

End Sub

LMS ©Neha Chauhan 58 SBOTE – Branch Computer


Form Auditing Book

LMS ©Neha Chauhan 59 SBOTE – Branch Computer


LMS ©Neha Chauhan 60 SBOTE – Branch Computer
'Declaring variables

Dim rs As Record set

Dim X%, z%

'=======================================

'This module is used for adding new book to "Book” table of

‘“Lib.mdb" an MSAccess database

Private Sub Command2_Click ()

End Sub

Private Sub Command1_Click (Index as Integer)


If Index = 0 Then
On Error Go To my err

Dim I%
I=0
For Each Control In frmBAdd
If Type Of Control Is Textbox or Type Of Control Is Combo
Box Then

LMS ©Neha Chauhan 61 SBOTE – Branch Computer


If Control. Text = "" Then
I=1
End If
End If
Next
If I = 0 Then
rs.AddNew
Rs ("booked") = Trim (Text1 (0).Text)
Rs ("title") = Trim (Text1 (1).Text)
Rs ("vAuthor") = Trim (Text1 (2).Text)
Rs ("vCategory") = Trim (Combo1.Text)
Rs ("iCostPrice") = Trim (Text1 (3).Text)

LMS ©Neha Chauhan 62 SBOTE – Branch Computer


Rs ("copies") = Trim (Text1 (5).Text)
Rs ("iISBN") = Trim (Text1 (4).Text)
Rs ("vDesc") = Trim (Text1 (6).Text)
Rs ("iRentStatus") = 0
rs.Update
MsgBox "Data Added", 0, "Book Library"
Command1 (0).Enabled = False
Command1 (1).Caption = "Close"
Command3.Enabled = True
Else

MsgBox "Incorrect Data Provided", 0, "Book Library"


End If
Exit Sub
Myerr:
MsgBox "Data Type Mismatch"
Exit Sub
Else
If Index = 1 Then
Unload Me
End If

End If
End Sub

LMS ©Neha Chauhan 63 SBOTE – Branch Computer


Private Sub Command3_Click ()
Call Form Load
End Sub

Private Sub Form Load ()


Call Connect
Set rs = New Record set
z = BookAutoGen
If z < 10 Then
StrRegNo = "B000" + CStr (z)
Else If z < 100 Then
StrRegNo = "B00" + CStr (z)
Else If z < 1000 Then
StrRegNo = "B0" + CStr (z)
Else If z < 10000 Then
StrRegNo = "B" + CStr (z)
End If
Text1 (0).Text = strRegNo
Text1 (0).Enabled = False
Command3.Enabled = False
Command1 (0).Enabled = True
For I = 1 to Text1.UBound
Text1(i).Text = ""

LMS ©Neha Chauhan 64 SBOTE – Branch Computer


Next i
End Sub

Private Function BookAutoGen () As Integer


Dim X as Integer
rs.Open "select * from Book", con, adOpenDynamic,
adLockPessimistic
If rs.BOF = True Then
X=1
BookAutoGen = X
Else
rs.MoveLast
K = mid (rs! vbookid, 3)
X=K+1
End If
BookAutoGen = X
End Function

Private Sub Form Unload (Cancel as Integer)


mdiStart.mnuNew.Enabled = True
End Sub

Private Sub Text4_KeyPress (Key ASCII as Integer)


If (Key ASCII >= 65 and Key ASCII <= 90) or (Key ASCII >= 97
and Key ASCII <= 122) Then
Key ASCII = 0
End If
End Sub

LMS ©Neha Chauhan 65 SBOTE – Branch Computer


Private Sub Text6_KeyPress (Key ASCII as Integer)
If (Key ASCII >= 65 and Key ASCII <= 90) or (Key ASCII >= 97
and Key ASCII <= 122) Then
Key ASCII = 0
End If
End Sub
Private Sub Text1_KeyPress (Index As Integer, Key ASCII as
Integer)
If Index = 1 Then
If Not ((Key ASCII >= 65 and Key ASCII <= 90) or (Key ASCII
>= 97 and Key ASCII <= 122) or Key ASCII = 8 or Key ASCII =
32) Then
Key ASCII = 0
End If
Else
If Index = 2 Then
If Not ((Key ASCII >= 65 and Key ASCII <= 90) or (Key ASCII
>= 97 and Key ASCII <= 122) or Key ASCII = 8 or Key ASCII =
32) Then
Key ASCII = 0
End If
End If

If Index = 3 Then
If Not ((Key ASCII >= 48 And Key ASCII <= 57) Or (Key ASCII
= 8)) Then

LMS ©Neha Chauhan 66 SBOTE – Branch Computer


Key ASCII = 0
End If
End If

If Index = 4 Then
If Not ((Key ASCII >= 65 and Key ASCII <= 90) or (Key ASCII
>= 97 and Key ASCII <= 122) or (Key ASCII >= 48 and Key
ASCII <= 57) or Key ASCII = 8 or Key ASCII = 45) Then
Key ASCII = 0
End If
End If

If Index = 5 Then
If Not ((Key ASCII >= 48 and Key ASCII <= 57) or (Key ASCII
= 8)) Then
Key ASCII = 0
End If
End If
If Index = 6 Then
If Not ((Key ASCII >= 65 and Key ASCII <= 90) or (Key ASCII
>= 97 and Key ASCII <= 122) or Key ASCII = 8 or Key ASCII =
32 or Key ASCII = 13) Then
Key ASCII = 0
End If
End If
End If
End Sub

LMS ©Neha Chauhan 67 SBOTE – Branch Computer


Form for Updating Book

LMS ©Neha Chauhan 68 SBOTE – Branch Computer


LMS ©Neha Chauhan 69 SBOTE – Branch Computer
'Declaring variable
Dim rs As Record set
'============================================='’Th
is module is used for searching and then updating details of a
‘book already present in "Book" table of "Lib.mdb" a
MSAccess ‘database
Private Sub Command1_Click ()
rs.Open "select * from book where vBookId='" & Trim
(Text1.Text) & "'", con, adOpenDynamic, adLockOptimistic
If rs.BOF = True Then
MsgBox "No Record Found", 0, "Book Library"
Text1.Text = ""
Command1.Enabled = False
Command2.Enabled = True
Text1.SetFocus
Exit Sub
Else
Frame1.Visible = True
Text2.Text = rs ("vBookId")
Text3.Text = rs ("vTitle")
Text4.Text = rs ("vAuthor")
Text5.Text = rs ("iISBN")
Text6.Text = rs ("copies")
Text7.Text = rs ("vCategory")
Text8.Text = rs ("iLostPrice")
Text9.Text = rs ("vDesc")
For Each Control In frmBUpd
If Type Of Control Is Textbox

LMS ©Neha Chauhan 70 SBOTE – Branch Computer


Then
Control. Enabled = False
End If
Next
Text6.Enabled = True
Text8.Enabled = True
Text9.Enabled = True
Command1.Enabled = False
Command3.Enabled = False
Command4.Enabled = True
Text6.SetFocus
End If
End Sub

Private Sub Command2_Click ()


Command1.Enabled = True
Command2.Enabled = False
Text1.Enabled = True
Text1.Text = ""
Text1.SetFocus
rs.Close
End Sub

Private Sub Command3_Click ()


Unload Me
End Sub

Private Sub Command4_Click ()

LMS ©Neha Chauhan 71 SBOTE – Branch Computer


On Error Go To myerr
Rs ("copies") = Text6.Text
Rs ("iLostPrice") = Text8.Text
Rs ("vDesc") = Text9.Text

Dim i%
i = MsgBox ("Do you want to update current Record?",
vbYesNo, "Book Library")
If i = 6 Then
rs.Update
MsgBox "Record Updated", 0, "Book Library"
Else
rs.CancelUpdate
MsgBox "O.K", 0, "Book Library"
End If
Command4.Enabled = False
Command2.Enabled = True
Exit Sub
Myerr:
MsgBox "Data Type Mismatch"
Exit Sub
End Sub

Private Sub Command5_Click ()


Frame1.Visible = False
Command3.Enabled = True
Command2.Enabled = True
End Sub

LMS ©Neha Chauhan 72 SBOTE – Branch Computer


Private Sub Form Load ()
Call Connect
Set rs = New Record set
Frame1.Visible = False
Command2.Enabled = False
End Sub

Private Sub Form Unload (Cancel as Integer)


mdiStart.mnuUpd.Enabled = True
End Sub

LMS ©Neha Chauhan 73 SBOTE – Branch Computer


Form for Searching Book

LMS ©Neha Chauhan 74 SBOTE – Branch Computer


LMS ©Neha Chauhan 75 SBOTE – Branch Computer
‘Declaring variables
Dim rs As Recorded
'=============================================’’Th
is module is used for searching a particular book or books from
‘"Book” table of “Lib.mdb" a MSAccess database
Private Sub Command1_Click ()
Call Connect
Set rs = New Record set
If Option2.Value = True Then
rs.Open "SELECT * FROM BOOK WHERE VBOOKID=" &
"'" & Text1.Text & "'", con, adOpenKeyset
If Not (rs.BOF or rs.EOF) = True Then
Set DataGrid1.DataSource = rs
DataGrid1.Visible = True
Else
MsgBox "NO SUCH BOOKID EXISTS"
End If
Else If Option1.Value = True Then
rs.Open "SELECT * FROM BOOK WHERE VTITLE=" & "'"
& Text1.Text & "'", con, adOpenKeyset

LMS ©Neha Chauhan 76 SBOTE – Branch Computer


LMS ©Neha Chauhan 77 SBOTE – Branch Computer
If Not (rs.BOF or rs.EOF) = True Then
Set DataGrid1.DataSource = rs
DataGrid1.Visible = True
Else
MsgBox "NO SUCH BOOK TITLE FOUND"
End If
Else
MsgBox "PLZ SELECT UR OPTION"
End If
End Sub

Private Sub Command2_Click ()


Unload Me
mdiStart.ser.Enabled = True
End Sub

Private Sub Command3_Click ()


Call Connect
Set rs = New Record set

LMS ©Neha Chauhan 78 SBOTE – Branch Computer


If Command3.Caption = "SHOW ALL BOOKS" Then
rs.Open "SELECT * FROM BOOK ", con,

adOpenKeyset
Set DataGrid1.DataSource = rs
DataGrid1.Visible = True
Command3.Caption = "HIDE ALL"
Else
Set DataGrid1.DataSource = Nothing
DataGrid1.Visible = False
Command3.Caption = "SHOW ALL BOOKS"
End If
End Sub

Private Sub Form Load ()


frmser.WindowState = 2
End Sub
Private Sub Form_Unload (Cancel as Integer)
mdiStart.ser.Enabled = True
End Sub

LMS ©Neha Chauhan 79 SBOTE – Branch Computer


Form for Deleting Books

LMS ©Neha Chauhan 80 SBOTE – Branch Computer


LMS ©Neha Chauhan 81 SBOTE – Branch Computer
'Declaring variable
Dim rs As Recorded

'============================================='’Th
is module is used for searching and deleting a book from "Book"
‘table of "Lib.mdb" a MSAccess database

Private Sub Command1_Click ()


Dim i%
i = MsgBox ("Do you want to delete this book?", vbYesNo,
"Book Library")
If i = 6 Then
If Rent Status = 0 Then
MsgBox "You can't delete this book, It is issued",
vbInformation, "Book Library"
Exit Sub
Else
rs.Delete
MsgBox "Book Deleted", 0, "Book Library"
Shown one
Command4.Enabled = True
End If
Else
MsgBox "O.K", 0, "Book Library"
End If
Unload Me
End Sub

Private Sub Command2_Click ()


rs.CancelUpdate

LMS ©Neha Chauhan 82 SBOTE – Branch Computer


Unload Me
mdiStart.mnuDel.Enabled = True
End Sub

Private Sub Command3_Click ()


rs.Open "select * from book where vBookId='" & Trim
(Text1.Text) & "'", con, adOpenDynamic, adLockOptimistic
If rs.BOF = True Then
MsgBox "No Record Found", 0, "Book Library"
Text1.Enabled = False
Show None
Command4.Enabled = True
rs.Close
Else
Text2.Text = rs ("vBookId")
Text3.Text = rs ("vTitle")
Text4.Text = rs ("vAuthor")
Text5.Text = rs ("iISBN")
Text6.Text = rs ("copies")
Text7.Text = rs ("iLostPrice")
If Rent Status = 0 Then
Text8.Text = "Copies Rented"
Else If Rent Status = 1 Then
Text8.Text = "All Copies Available"
End If
Show All
End If
End Sub

LMS ©Neha Chauhan 83 SBOTE – Branch Computer


Private Sub Command4_Click ()
Show None
Text1.Enabled = True
Text1.Text = ""
Text1.SetFocus
Command3.Enabled = True
Command4.Enabled = False

End Sub

Private Sub Command5_Click ()


Unload Me
mdiStart.mnuDel.Enabled = True
End Sub

Private Sub Form Load ()


Call Connect
Set rs = New Recorded

Show None
Command3.Enabled = True
Command4.Enabled = False
End Sub

Private Function Rent Status () As Integer


Dim a%
a = rs ("iRentStatus")

LMS ©Neha Chauhan 84 SBOTE – Branch Computer


If a > 0 Then
Rent Status = 0
Else
Rent Status = 1
End If

End Function

Private Sub Show All ()


Command1.Visible = True
Command2.Visible = True
Text2.Visible = True
Text3.Visible = True
Text4.Visible = True
Text5.Visible = True
Text6.Visible = True
Text7.Visible = True
Text8.Visible = True
Command3.Enabled = False
Command4.Enabled = True
Command1.Enabled = True
Command2.Enabled = True
For Each Control In fumbled
If Type of Control Is Textbox Then
Control. Enabled = False
End If
Next
End Sub

LMS ©Neha Chauhan 85 SBOTE – Branch Computer


Private Sub Show None ()
Command1.Visible = False
Command2.Visible = False
Text2.Visible = False
Text3.Visible = False
Text4.Visible = False
Text5.Visible = False
Text6.Visible = False
Text7.Visible = False

Text8.Visible = False
For i = 1 to Label1.UBound
Label1 (i).Visible = False
Next i
Command3.Enabled = False
Command4.Enabled = False
End Sub

Private Sub Form Resize ()

For i = 0 to Label1.UBound
Label1 (i).Height = Me.ScaleHeight / 22
Label1 (i).Left = Me.ScaleWidth / 11
Label1 (i).Top = Me.ScaleHeight / 40 * j
Next i
End Sub

Private Sub Form_Unload (Cancel as Integer)


mdiStart.mnuDel.Enabled = True

LMS ©Neha Chauhan 86 SBOTE – Branch Computer


End Sub

Form for Adding Member


LMS ©Neha Chauhan 87 SBOTE – Branch Computer
LMS ©Neha Chauhan 88 SBOTE – Branch Computer
LMS ©Neha Chauhan 89 SBOTE – Branch Computer
‘Declaring variables
Dim rs As Record set
Dim X%, z%
'=============================================
'This module is used for adding a new member in "Student”
table of “Lib.mdb" a MSAccess database
Private Sub Command1_Click ()
Dim i%
i=1
For Each Control In frmCAdd
If Type Of Control Is Textbox Then
If Control. Text = "" Then
i=0
MsgBox ("empty" & Control. Name)
End If
End If
Next
If i = 0 Then
MsgBox "Incorrect Data Provided", 0, "Book Library"
Text2.SetFocus
Else
rs.AddNew
Rs ("vStuId") = Trim (Text1.Text)
Rs ("vName") = Trim (Text2.Text)
Rs ("vAdd") = Trim (Text3.Text)
If Is Numeric (Text4.Text) Then rs ("iPhone") = VBA.CDbl
(Trim (Text4.Text))
Rs ("vEmail") = Trim (Text5.Text)

LMS ©Neha Chauhan 90 SBOTE – Branch Computer


Rs ("vStatus1") = "A"
Rs ("vStatus2") = "A"
rs.Update
MsgBox "Member Added", 0, "Book Library"
Command1.Enabled = False
Command3.Enabled = True
Command2.Caption = "Close"
End If
End Sub

Private Sub Command2_Click ()


Unload Me
End Sub

Private Sub Command3_Click ()


Call Form Load
End Sub

Private Sub Form Load ()


Call Connect
Set rs = New Record set

rs.Open "select * from Student", con, adOpenDynamic,


adLockOptimistic
z = StuAutoGen
If z < 10 Then
StrRegNo = "M000" + CStr (z)
Else If z < 100 then
StrRegNo = "M00" + CStr (z)

LMS ©Neha Chauhan 91 SBOTE – Branch Computer


Else If z < 1000 Then
StrRegNo = "M0" + CStr (z)

Else If z < 10000 Then


StrRegNo = "M" + CStr (z)
End If
Text1.Text = strRegNo
Text1.Enabled = False
Command1.Enabled = True
Command3.Enabled = False
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
End Sub

Private Function StuAutoGen() As Integer


Dim X as Integer

If rs.BOF = True Then


X=1
StuAutoGen = X
Else
rs.MoveLast
K = mid (rs! vStuid, 3)
X=K+1

End If

LMS ©Neha Chauhan 92 SBOTE – Branch Computer


StuAutoGen = X
End Function

Private Sub Form_Unload (Cancel as Integer)


mdiStart.mnuNew2.Enabled = True

End Sub

Private Sub Text2_KeyPress (Key ASCII as Integer)


If Not ((KeyAscii >= 65 and KeyAscii <= 90) or (KeyAscii >= 97
and KeyAscii <= 122) or KeyAscii = 8 or KeyAscii = 32) Then
KeyAscii = 0
End If
End Sub

Private Sub Text3_KeyPress (KeyAscii as Integer)


If Not ((Key ASCII >= 65 and Key ASCII <= 90) or (Key ASCII
>= 97 and Key ASCII <= 122) or Key ASCII = 8 or Key ASCII =
32) Then
Key ASCII = 0
End If
End Sub

Private Sub Text4_KeyPress (Key ASCII as Integer)


If Not ((Key ASCII >= 48 and Key ASCII <= 57) or Key ASCII =
8) Then
Key ASCII = 0
End If

LMS ©Neha Chauhan 93 SBOTE – Branch Computer


End Sub

Private Sub Text5_KeyPress (Key ASCII as Integer)


If Not ((Key ASCII >= 65 And Key ASCII <=

90) Or (Key ASCII >= 97 And Key ASCII <=


122) Or (Key ASCII >= 48 And Key ASCII <= 57) Or KeyAscii =
8 Or Key ASCII = 45 Or KeyAscii = 95 Or KeyAscii = 64 Or Key
ASCII = 46) Then
KeyAscii = 0
End If
End Sub

LMS ©Neha Chauhan 94 SBOTE – Branch Computer


Form for Updating Member Record

LMS ©Neha Chauhan 95 SBOTE – Branch Computer


LMS ©Neha Chauhan 96 SBOTE – Branch Computer
'Declaring variable
Dim rs As Record set
'============================================='’Th
is module is used for searching a member and updating
‘information about the member "Student” table of “Lib.mdb" a
‘MSAccess database
Private Sub Command1_Click ()
Command1.Enabled = False
Command2.Enabled = False
Command3.Enabled = False
rs.Open "select * from Student where vStuId='" & Trim
(Text1.Text) & "'", con, adOpenDynamic, adLockOptimistic
If rs.BOF Then
MsgBox "No Record Found", 0, "Book Library"
Shown one
Command2.Enabled = True
Command3.Enabled = True
Else
Text2.Text = rs ("vStuId")
Text3.Text = rs ("vName")
Text4.Text = rs ("vAdd")
Text5.Text = rs ("iPhone")
Text6.Text = rs ("vEmail")
Show All
Text1.Enabled = False
Text2.Enabled = False
Text3.Enabled = False
Command1.Enabled = False
End If

LMS ©Neha Chauhan 97 SBOTE – Branch Computer


End Sub

Private Sub Command2_Click ()


Text1.Enabled = True
Text1.Text = ""
Text1.SetFocus
Command1.Enabled = True
Command2.Enabled = False
rs.Close
End Sub

Private Sub Command3_Click ()


Unload Me
End Sub

Private Sub Command4_Click ()


On Error Go To myerr
Rs ("vAdd") = Trim (Text4.Text)
Rs ("iPhone") = Trim (Text5.Text)
Rs ("vEmail") = Trim (Text6.Text)
rs.Update
MsgBox "Member Details Updated", 0, "Book Library"
Show None
Command2.Enabled = True
Command3.Enabled = True
Exit Sub
Myerr:
MsgBox "Data Type Mismatch"

LMS ©Neha Chauhan 98 SBOTE – Branch Computer


Exit Sub
End Sub

Private Sub Command5_Click ()


Show None
Command2.Enabled = True
Command3.Enabled = True
End Sub

Private Sub Form Load ()


Call Connect
Set rs = New Record set
Command2.Enabled = False
Show None
End Sub

Private Sub Form_Unload (Cancel as Integer)


mdiStart.mnuUpd2.Enabled = True
End Sub
Private Sub Show None ()
Label2.Visible = False
Label3.Visible = False
Label4.Visible = False
Label5.Visible = False
Label6.Visible = False
Text2.Visible = False
Text3.Visible = False
Text4.Visible = False

LMS ©Neha Chauhan 99 SBOTE – Branch Computer


Text5.Visible = False
Text6.Visible = False
Command4.Visible = False
Command5.Visible = False
End Sub
Private Sub Show All ()
Label2.Visible = True

Label3.Visible = True
Label4.Visible = True
Label5.Visible = True
Label6.Visible = True
Text2.Visible = True
Text3.Visible = True
Text4.Visible = True
Text5.Visible = True
Text6.Visible = True
Command4.Visible = True
Command5.Visible = True
End Sub

LMS ©Neha Chauhan 100 SBOTE – Branch Computer


Form for Deleting Member

LMS ©Neha Chauhan 101 SBOTE – Branch Computer


LMS ©Neha Chauhan 102 SBOTE – Branch Computer
'Declaring variable
Dim rs As Record set
'========================================='’This
module is used for searching and deleting a member ‘from
"Student” table of “Lib.mdb" a MSAccess database
Private Sub Command1_Click ()
Command1.Enabled = False
Command2.Enabled = False
Command3.Enabled = False
rs.Open "select * from student where vStuId='" & Trim
(Text1.Text) & "'", con, adOpenDynamic, adLockOptimistic
If rs.BOF Then
MsgBox "No Record Found", 0, "Book Library"
Show None
Command2.Enabled = True
Command3.Enabled = True
Else
Text2.Text = rs ("vStuId")
Text3.Text = rs ("vName")
Text4.Text = rs ("vAdd")
Text5.Text = rs ("iPhone")
Text6.Text = rs ("vEmail")
Dim i%
i = Check Status
If i = 0 Then
Text7.Text = "Cleared"
Else
Text7.Text = "Not Cleared"
End If

LMS ©Neha Chauhan 103 SBOTE – Branch Computer


Show All
For Each Control In farced
If Type Of Control Is Textbox Then
Control. Enabled = False
End If
Text1.Enabled = False
Command1.Enabled = False
Next
End If

End Sub

Private Sub Command2_Click ()


Command1.Enabled = True
Text1.Enabled = True
Text1.Text = ""
Text1.SetFocus
rs.Close
Command2.Enabled = False
End Sub

Private Sub Command3_Click ()


Unload Me
End Sub

Private Sub Command4_Click ()


If Check Status = 1 Then

LMS ©Neha Chauhan 104 SBOTE – Branch Computer


MsgBox "Member Can't be deleted, Book Outstanding!",
vbInformation, "Book Library"
Else

Dim s%
s = MsgBox ("Are you sure?", vbYesNo, "Book Library")
If s = 6 Then
rs.Delete
MsgBox "Member Deleted", 0, "Book Library"
Command5_Click
Else
MsgBox "O.K", 0, "Book Library"
End If
End If
End Sub

Private Sub Command5_Click ()


Show None
Command2.Enabled = True
Command3.Enabled = True
End Sub

Private Sub Form Load ()


Call Connect
Set rs = New Record set
Command2.Enabled = False
ShowNone
End Sub

LMS ©Neha Chauhan 105 SBOTE – Branch Computer


Private Sub ShowNone ()
Label2.Visible = False
Label3.Visible = False
Label4.Visible = False
Label5.Visible = False

Label6.Visible = False
Label7.Visible = False
Text2.Visible = False
Text3.Visible = False
Text4.Visible = False
Text5.Visible = False
Text6.Visible = False
Text7.Visible = False
Command4.Visible = False
Command5.Visible = False
End Sub

Private Sub Show All ()


Label2.Visible = True
Label3.Visible = True
Label4.Visible = True
Label5.Visible = True
Label6.Visible = True
Label7.Visible = True
Text2.Visible = True
Text3.Visible = True
Text4.Visible = True

LMS ©Neha Chauhan 106 SBOTE – Branch Computer


Text5.Visible = True
Text6.Visible = True
Text7.Visible = True
Command4.Visible = True
Command5.Visible = True
End Sub

Private Function Check Status () As Integer


Dim a$, b$
a = rs ("vStatus1")

b = rs ("vStatus2")
If a = "A" And b = "A" Then
Check Status = 0
Else
Check Status = 1
End If
End Function

Private Sub Form_Unload (Cancel as Integer)


mdiStart.mnuDel2.Enabled = True
End Sub

LMS ©Neha Chauhan 107 SBOTE – Branch Computer


LMS ©Neha Chauhan 108 SBOTE – Branch Computer
Form for Issuing Book

LMS ©Neha Chauhan 109 SBOTE – Branch Computer


LMS ©Neha Chauhan 110 SBOTE – Branch Computer
'Declaring variables
Dim rs As Record set
Dim rs1 As Record set
Dim X%, z%
'=========================================
'This module is used for issuing a book and adding that
‘information in "Issue" table of "Lib.mdb" a MSAccess
‘database
Private Sub Command1_Click ()
rs1.Open "select * from book where vBookId='" &
Trim (Text4.Text) & "'", con, adOpenDynamic,
adLockPessimistic
If rs1.BOF Then
MsgBox "No Such Record Found", 0, "Book Library"
Text4.SetFocus
rs1.Close
Else
MsgBox "Book Id Validated", 0, "Book Library"
Text5.SetFocus
rs1.Close
Command2.Enabled = True
End If
End Sub

Private Sub Command2_Click ()


rs1.Open "select * from Student where vStuId='" & Trim
(Text5.Text) & "'", con, adOpenDynamic, adLockOptimistic

LMS ©Neha Chauhan 111 SBOTE – Branch Computer


If rs1.BOF Then
MsgBox "No Such Record Found", 0, "Book Library"
rs1.Close
Else
Dim a$, b$
a = rs1 ("vStatus1")
b = rs1 ("vStatus2")
If a = "A" Or b = "A" Then
MsgBox "Member Validated", 0, "Book Library"
rs1.Close
Command3.Enabled = True
Else
MsgBox "All Cards are full", 0, "Book Library"
Text5.Text = ""
Text5.SetFocus
rs1.Close
Text5.SetFocus
End If
End If
End Sub

Private Sub Command3_Click ()


If Checkbook = 0 Then
Exit Sub
End If
If Check Member = 0 Then
Exit Sub
End If
rs.Close

LMS ©Neha Chauhan 112 SBOTE – Branch Computer


rs1.Close
rs.Open "select * from issue", con, adOpenDynamic,
adLockOptimistic
rs1.Open "select * from book where vBookId='" & Trim
(Text4.Text) & "'", con, adOpenDynamic, adLockOptimistic
rs.AddNew
Rs ("vIssueId") = Trim (Text1.Text)
Rs ("dIssueDate") = CDate (Trim (Text2.Text))
Rs ("dReturnDate") = CDate (Trim (Text3.Text))
Rs ("vBookId") = Trim (Text4.Text)
Rs ("vStuId") = Trim (Text5.Text)
Rs ("vStatus") = "R"
Rs ("dt") = Date
rs.Update
rs1 ("iRentStatus") = rs1 ("iRentStatus") + 1
rs1.Update
rs1.Close
rs1.Open "select * from Student where vStuId='" & Trim
(Text5.Text) & "'", con, adOpenDynamic, adLockOptimistic
Dim a$, b$
a = rs1 ("vStatus1")
b = rs1 ("vStatus2")
If a = "A" Then
rs1 ("vStatus1") = "B"
rs1.Update
Else
If b = "A" Then

LMS ©Neha Chauhan 113 SBOTE – Branch Computer


rs1 ("vStatus2") = "B"
rs1.Update
End If
End If
MsgBox "Book Issued", 0, "Book Library"
Command3.Enabled = False
Command5.Enabled = True

End Sub

Private Sub Command4_Click ()


Text2.Enabled = False
Unload Me
End Sub

Private Sub Command5_Click ()


Call Form Load
'Command3.Enabled = True
End Sub

Private Sub Form Load ()


Call Connect
Set rs = New Record set
Set rs1 = New Record set

com.ActiveConnection = con
rs.Open "select * from issue", con, adOpenDynamic,
adLockPessimistic
z = IssueAutoGen

LMS ©Neha Chauhan 114 SBOTE – Branch Computer


If z < 10 Then
StrRegNo = "I000" + CStr (z)
Else If z < 100 Then

StrRegNo = "I00" + CStr (z)


Else If z < 1000 then
StrRegNo = "I0" + CStr (z)
Else If z < 10000 Then
StrRegNo = "I" + CStr (z)
End If

Text1.Text = strRegNo
Text2 = Format (Date, "mm-day")
Text1.Enabled = False
Command2.Enabled = False
Command3.Enabled = False
Command5.Enabled = False
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""

MsgBox "Note:-A member can keep only two books


simultaneously", , "LIBRARY MANAGEMENT SYSTEM"
End Sub

Private Function IssueAutoGen () As Integer


Dim X as Integer

LMS ©Neha Chauhan 115 SBOTE – Branch Computer


If rs.BOF = True Then
X=1
IssueAutoGen = X
Else
rs.MoveLast
K = mid (rs! VIssueId, 3)

X=K+1
End If
IssueAutoGen = X
End Function

Private Sub Form_Unload (Cancel As Integer)


mdiStart.mnuRent1.Enabled = True
End Sub

Private Sub Text2_LostFocus ()


If Text2.Text = "" Then
If Text4.Text <> "" Or Text5.Text <> "" Then
MsgBox "Enter Issue Date", 0, "Book Library"
Text2.SetFocus
End If
Else
Text3.Text = ""
Text3.Text = CDate (Text2.Text) + 10
Text3.Enabled = False
End If
End Sub

LMS ©Neha Chauhan 116 SBOTE – Branch Computer


Private Function Checkbook () As Integer
rs1.Open "select * from book where vBookId='" & Trim
(Text4.Text) & "'", con, adOpenDynamic, adLockOptimistic
Dim i%, j%
i = rs1 ("iRentStatus")
j = rs1 ("iCopies")

If i - j = 0 Then
MsgBox "No Copies Left", 0, "Book Library"
rs1.Close
Checkbook = 0
Exit Function
End If
Checkbook = 1
End Function

Private Function Check Member () As Integer


rs1.Close
rs1.Open "select * from Student where vStuId='" & Trim
(Text5.Text) & "'", con, adOpenDynamic, adLockOptimistic
Dim a$, b$
a = rs1 ("vStatus1")
b = rs1 ("vStatus2")
If a = "B" And b = "B" Then
MsgBox "No Cards Left", 0, "Book Library"
rs1.Close
Check Member = 0
Exit Function
End If

LMS ©Neha Chauhan 117 SBOTE – Branch Computer


Check Member = 1
End Function

Private Sub Text3_KeyPress (KeyAscii as Integer)

If Not ((KeyAscii >= 48 and KeyAscii <= 57) or KeyAscii = 8 or


KeyAscii = 45) Then
KeyAscii = 0
End If
End Sub

LMS ©Neha Chauhan 118 SBOTE – Branch Computer


LMS ©Neha Chauhan 119 SBOTE – Branch Computer
Form for Returning Book

LMS ©Neha Chauhan 120 SBOTE – Branch Computer


LMS ©Neha Chauhan 121 SBOTE – Branch Computer
'Declaring variables
Dim rs2 As Record set
Dim rs As Record set
Dim rs1 As Record set
Dim issue As String

'Private Sub Command1_Click ()


'End Sub
’This module is used for returning a book and updating
‘information in "Issue" table of "Lib.mdb" a MSAccess
‘database .
Private Sub Command1_Click ()
rs.Open "select * from book where vBookId='" & Trim
(Text1.Text) & "'", con, adOpenDynamic, adLockOptimistic
rs1.Open "select * from Student where vStuId='" & Trim
(Text2.Text) & "'", con, adOpenDynamic, adLockOptimistic
rs2.Open "select * from issue where vStuId='" & Trim
(Text2.Text) & "' and vBookId='" & Trim (Text1.Text) & "' and

LMS ©Neha Chauhan 122 SBOTE – Branch Computer


vStatus='R'", con, adOpenDynamic, adLockOptimistic
If rs.BOF Then
MsgBox "No Book Record Found", 0, "Book Library"
Text1.Text = ""
Text2.Text = ""

LMS ©Neha Chauhan 123 SBOTE – Branch Computer


rs.Close
rs1.Close
rs2.Close
Text1.SetFocus
Exit Sub
End If
If rs1.BOF Then
MsgBox "No Member Record Found", 0, "Book Library"
Text1.Text = ""
Text2.Text = ""
rs.Close
rs1.Close
rs2.Close
Text1.SetFocus
Exit Sub
End If
If rs2.BOF Then
MsgBox "No Such Issue Record Found", 0, "Book Library"
Text1.Text = ""

LMS ©Neha Chauhan 124 SBOTE – Branch Computer


LMS ©Neha Chauhan 125 SBOTE – Branch Computer
Text2.Text = ""
rs.Close
rs1.Close
rs2.Close
Text1.SetFocus
Exit Sub
End If
Issue = rs2 ("vIssueId")
Rs ("iRentStatus") = rs ("iRentStatus") - 1
If rs1 ("vStatus1") = "B" Then
rs1 ("vStatus1") = "A"
Else
If rs1 ("vStatus2") = "B" Then
rs1 ("vStatus2") = "A"
Else
MsgBox "Illegal Transaction", 0, "Book Library"
Text1.Text = ""
Text2.Text = ""
rs.Close
rs1.Close

LMS ©Neha Chauhan 126 SBOTE – Branch Computer


LMS ©Neha Chauhan 127 SBOTE – Branch Computer
rs2.Close
Text1.SetFocus
Exit Sub
End If
End If
rs2 ("vStatus") = "C"
rs2 ("rent") = 5
rs2 ("dt") = Date
Dim a As Date
a = rs2 ("dReturnDate")
Dim X as Double
X = DateDiff ("d", a, Date)
X=4*X
If X > 0 Then
rs2 ("iFine") = X
Else
rs2 ("ifine") = 0
End If
rs2 ("dActRetDate") = Date
If X > 0 Then

LMS ©Neha Chauhan 128 SBOTE – Branch Computer


rs2 ("iTotAmt") = 5 + X
Else

X=0
rs2 ("iTotAmt") = 5 + X
End If
rs.Update
rs1.Update
rs2.Update
rs.Close
rs1.Close
rs2.Close
MsgBox "Book Rent: Rs. 5", 0, "Book Library"
MsgBox "Fine: Rs. " & X, 0, "Book Library"
MsgBox "Total Amount: Rs. " & 5 + X, 0, "Book Library"
MsgBox "Book Returned, Data Updated", 0, "Book Library"
End Sub
Private Sub Command4_Click ()
Unload Me
End Sub

LMS ©Neha Chauhan 129 SBOTE – Branch Computer


Private Sub Command2_Click ()
Unload Me
End Sub

Private Sub Command3_Click ()


rs.Open "select * from book where vBookId='" & Trim
(Text1.Text) & "'", con, adOpenDynamic, adLockOptimistic
rs1.Open "select * from Student where vStuId='" & Trim
(Text2.Text) & "'", con, adOpenDynamic, adLockOptimistic
rs2.Open "select * from issue where vStuId='" & Trim
(Text2.Text) & "' and vBookId='" & Trim (Text1.Text) & "' and
vStatus='R'", con, adOpenDynamic, adLockOptimistic
If rs.BOF Then
MsgBox "No Book Record Found", 0, "Book Library"
Text1.Text = ""
Text2.Text = ""
rs.Close

LMS ©Neha Chauhan 130 SBOTE – Branch Computer


rs1.Close
rs2.Close
Text1.SetFocus
Exit Sub
End If
If rs1.BOF Then
MsgBox "No Member Record Found", 0, "Book Library"
Text1.Text = ""
Text2.Text = ""
rs.Close
rs1.Close
rs2.Close
Text1.SetFocus
Exit Sub
End If
If rs2.BOF Then
MsgBox "No Such Issue Record Found", 0, "Book Library"
Text1.Text = ""
Text2.Text = ""
rs.Close

LMS ©Neha Chauhan 131 SBOTE – Branch Computer


LMS ©Neha Chauhan 132 SBOTE – Branch Computer
rs1.Close
rs2.Close
Text1.SetFocus
Exit Sub
End If
Issue = rs2 ("vIssueId")
Rs ("iRentStatus") = rs ("iRentStatus") - 1
Rs ("iCopies") = rs ("iCopies") - 1
If rs1 ("vStatus1") = "B" Then
rs1 ("vStatus1") = "A"
Else
If rs1 ("vStatus2") = "B" Then
rs1 ("vStatus2") = "A"
Else
MsgBox "Illegal Transaction", 0, "Book Library"
Text1.Text = ""
Text2.Text = ""
rs.Close
rs1.Close
rs2.Close

LMS ©Neha Chauhan 133 SBOTE – Branch Computer


Text1.SetFocus
Exit Sub
End If
End If
rs2 ("vStatus") = "L"
rs2 ("iRent") = 5
Dim a As Date
a = rs2 ("dReturnDate")
Dim X, Y, z As Double
X = DateDiff ("d", a, Date)
X = 0.5 * X
Y = rs ("iLostPrice")
If X < 0 Then
X=0
End If
z=X+Y
rs2 ("iFine") = X
rs2 ("dActRetDate") = Date
rs2 ("iTotAmt") = 5 + z

LMS ©Neha Chauhan 134 SBOTE – Branch Computer


rs.Update
rs1.Update
rs2.Update

LMS ©Neha Chauhan 135 SBOTE – Branch Computer


rs.Close
rs1.Close
rs2.Close
MsgBox "Rent: Rs.5", 0, "Book Library"
MsgBox "Fine: Rs. " & X, 0, "Book Library"
MsgBox "Lost Price: Rs. " & Y, 0, "Book Library"
MsgBox "Total Amount: Rs." & 5 + X + Y, 0, "Book Library"
MsgBox "....Data Updated", 0, "Book Library"
End Sub
Private Sub Form Load ()
Call Connect
Set rs = New Record set
Set rs1 = New Record set
Set rs2 = New Record set
End Sub
Private Sub Form_Unload (Cancel as Integer)
mdiStart.mnuRet2.Enabled = True
End Sub

LMS ©Neha Chauhan 136 SBOTE – Branch Computer


Form for Generating Reports

LMS ©Neha Chauhan 137 SBOTE – Branch Computer


LMS ©Neha Chauhan 138 SBOTE – Branch Computer
'Declaring variable
Dim rs As Record set
'=========================================‘’this
module is used for showing different reports.There are ‘three
reports namely
‘'Books Report (showing information regarding available ‘books
in library)
'Student Report (showing information regarding members)
'Daily Report(showing daily transactions).It retrieves
‘information from "Book" , "Student" and "issue" tables of ‘
"Lib.mdb" a MSAccess database

Private Sub Command1_Click ()


Call Connect
Set rs = New Record set
rs.Open "select * from book", con, adOpenKeyset
Set drBooks.DataSource = rs
drBooks.Show
'Command1.Enabled = False
End Sub

Private Sub Command2_Click ()


Call Connect
Set rs = New Record set
rs.Open "select * from Student", con, adOpenKeyset
Set drstudent.DataSource = rs
drstudent.Show
'Command2.Enabled = False

LMS ©Neha Chauhan 139 SBOTE – Branch Computer


End Sub

Private Sub Command3_Click ()


Call Connect
Set rs = New Record set
rs.Open "select * from issue where trim (DT) =" & "'" & Date &
"'", con, adOpenKeyset
Set drDaily.DataSource = rs
drDaily.Show
'Command3.Enabled = False
End Sub

Private Sub Command4_Click ()


Unload Me
mdiStart.mnurep2.Enabled = True
End Sub

Private Sub Command5_Click ()


Call Connect
Set rs = New Record set
rs.Open "select * from issue", con, adOpenKeyset
Set drissued.DataSource = rs
drissued.Show
End Sub

Private Sub Form_Unload (Cancel as Integer)


mdiStart.mnurep2.Enabled = True
End Sub

LMS ©Neha Chauhan 140 SBOTE – Branch Computer


Books Report

LMS ©Neha Chauhan 141 SBOTE – Branch Computer


LMS ©Neha Chauhan 142 SBOTE – Branch Computer
Students Report

LMS ©Neha Chauhan 143 SBOTE – Branch Computer


LMS ©Neha Chauhan 144 SBOTE – Branch Computer
Daily Reports

LMS ©Neha Chauhan 145 SBOTE – Branch Computer


LMS ©Neha Chauhan 146 SBOTE – Branch Computer
Issued Book Report

LMS ©Neha Chauhan 147 SBOTE – Branch Computer


LMS ©Neha Chauhan 148 SBOTE – Branch Computer
Bibliography

1. Black Book of VB.Net


2. Bible of VB.Net
3. Software Engineering by Roger Pressman

Web Surfing

1. http:\google.co.in
2. http:\altavista.com

LMS ©Neha Chauhan 149 SBOTE – Branch Computer


LMS ©Neha Chauhan 150 SBOTE – Branch Computer
LMS ©Neha Chauhan 151 SBOTE – Branch Computer

You might also like