Anda di halaman 1dari 90

A

ON

Submitted in partial fulfillment of the requirement for the award of


Degree of
BACHELOR OF COMPUTER APPLICATION (BCA)

SUBMITTED TO

SUBMITTED BY

Ankur malik (8551044)

MISS. ANURADHA

Akash Malik (8551019)


Sonu kumar (8551247)
SUBMITTED TO

Department of Computer Science

SHRI RAM GROUP OF COLLEGES

We are the student of BCA 6th Semester in Shriram college Muzaffarnagar


(Affiliated to CCS University Meerut) hereby declare that the project report
on HOTEL MANAGEMENT SYSTEM is our original work.
We also declare that we have done our work ourselves and accurately even than
if there is a mistake or error in this work, we request to our faculty members to
point out these errors and guide us to remove these errors for our good future.
We are thankful to our faculty members.

Date:
Ankur malik (8551044)

Akash Malik (8551019)


Sonu kumar (8551247)

This project report on HOTEL MANAGEMENT SYSTEM is the result of idea and suggestions
to me by Miss. Anuradha.
I have received unfailing encouragement and inspiration of Miss. Anuradha whose exceptional
knowledge and unparalleled behavior is full of ardent inspiration in it. However, we can never
adequate thank all those who have their assistance, guidance, cooperation criticism contributed to the
improvement of this report. I am ebullient in expressing my intense in debtless heartiest gratitude to all
of them.
Since performance feedback is essential for effective communication, mistakes and creative feedback
of the report may be unhesitatingly communicated to me, who will be as far as possible duly
acknowledged and most welcome.
In this report, whatever is beneficial comes from almighty, and whatever is faulty is mine.

DATE

SUBMITTED BY
Ankur malik (8551044)

Akash Malik (8551019)


Sonu kumar (8551247)

Title (cover page)

Anknowledgement

Declaration

Contents

Certificate from study center


Students Certificate
Project introduction

Objective of the project

Scope of the project

Requirement specification

8-10

Block digram

11

Implementation

12-17

Problem definition

18-19

DFD of system

20

Front end and back end

21

Data dictnory

22

System development

23

Snap shots

24-40

Database design

41-47

Coding

48-86

Conclusion

87

Bibliography

88

List of websites

89

During our studies here in the first year and working in computer laboratory, I performed a
project on the basis of job training. I felt a golden opportunity for me while working on this project on
hotel management.
The project contains a detailed study about how is the inventory managed, how is billing done
and what all a business activities are done to manage the business and making it more fruitful. In this
project some screens and reports are also included. It also tells the files used by the company to do
their work and given the whole knowledge and information about the Hotel management.

Project title Hotel Management (a project for keeping customers record and also calculate customer
bill slip and managers salary)
The name of project is Hotel Management. The objective of the project is to computerize the
system of the hotel. Hotel Management is the project not only keeps the record of various people
like customers, manager etc. but as well as it reduce the extensive paper work in the present system. It
wills maker the system more versatile and user friendly. It also calculates the proper billing slip of
high level and middle level customers. This project is based on description about the structure of
HOTEL MANAGEMENT SYSTEM the project contains
Keeping the record of all persons like customers, managers etc.
Maintains proper list of all persons.

Generating proper bill slip and calculate managers salary.

The motive of our project is to control various activities performed. In the Hotel using the computer
with the work of HOTEL MANGEMENT SYSTEM. From the beginning, the important thing in our
mind is that we should concentrate our project work on a subject that is easy to understand and is
according to our daily requirement. By keeping this in mind, the subject chosen by us is hotel
management.
In the present time there is a great rush in hotels, as these have become necessity for middle
and upper class of the society. People travel a lot, stay in hotels, goes to the hotels for functions,
meeting and refreshment. Our project is developed keeping in mind the general needs of the customers
when he goes to the hospital. An important uniqueness about the described Hotels restaurants and bar
are available to only those customers who have already booked room or hall in hospital.

The structured systems development life cycle, as outlined by EDWARD YOURDAN in his book
modern structured analysis [1989] has been followed in this project with minor modifications. This
modified life cycle is shown overleaf.
The activities in this life cycle are explained in brief below:SURVEY:-

This activity is also known as the feasibility study. It begins with a request from the user for a new
system. It involves the following:
Identify the responsible users for the system.
Clarify the user request.
Identify deficiencies in the current system.
Establish goals and objectives for the new system.
Prepare a project charter that will be used to guide the remainder of the project.

SYSTEM ANALYSIS:The objectivity of system analysis is to develop structured system specification for the proposed
system. The structured system specification should describe what the proposed system would do,
independent of technology that will be used to implement these requirements. The structured system
specification will be called the essential model in many books essential model is called the logical
model. The essential model itself consists of multiple models, modelling different aspect of the
system. The data flow diagrams may model the function of the system, entity relationship diagrams
may model the data and their relationship and the state transition diagrams may model time dependent
behaviour of the system. The essential model in this project consist of only process model i.e. data
flow diagram. The essential model thus consist of the following :
Context Diagram.
Event List.
Levelled Data Flow Diagram.
Process Specification for the Flows and Stores on the DFDs.
Understand the current information system.
Analyse the current system to find the deficiencies in it.
Develop the functional specification for the new system.
Review the Feasibility, and Cost-Benefit Analysis.

PRELIMINARY DESIGN
This activity deals with certain design issues, which are to be finalised in consultation with the user.
The two most important design issues of the relevance to the user are the automation boundary and the
human-machine interface, the output of this proposed system. This model in addition to the essential
model defines the following for the proposed system.
1.

Automation Boundary

2.

Report Layout.

3.

Screen Layout for the Data Entry Forms.

4.

The parts of the new system consist of.

5.

The physical layout of the input and output document.


9

6.

The user interface of the software for the system.

SYSTEM DESIGN
System design involves transformation of the user implementation model into software design. The
design specification of the proposed system consists of the following:
7.

Develop the modules structure for the software.

8.

Develop the specification for each module.

9.

Design the file layout or the database.

10

BLOCK DIAGRAM

11

This activity is actually concerned with the development of software. It includes various operations:
Programming
Testing
Integration of modules into a progressively more complete system.

ACCEPTANCE TEST GENERATION


This activity generates a set of test data, which can be used to test the new system before accepting
information technology.

QUALITY ASSURANCE
Quality assurance is also known as final testing or acceptance testing. This activity requires, as its
input, acceptance test data generated in activity 6 and an integrated system produced by activity 5.

PROCEDURE DESCRIPTION
This activity involves the development of the user manual for the new system. Here we describe the
process we have given in implementation activity.

DATABASE CONVERSION
This activity involves conversion of data from the existing system to the new system.

12

INSTALLATION
This is the last activity in the system development life cycle. The changeover from the current system
to the new system is done.
This project involved all the activities in the life cycle except for database conversion and installation

Problem with Conventional (Manual) System


This is Problem definition and it includes the description of the current system and the deficiencies in
the current system. Current system is manual maintenance of all the entities and transaction of the
library.

1.

Lack of the immediate information retrieval :


The manual system lacks immediate retrieval of information. This problem is common to all of us just
to retrieve the information about the availability of Customers, etc...

2.

Lack of immediate information storage :


The manual system lack immediate storage of information. To store proper information at proper
place, we need to find a proper place in our Customer and we need to store the information at the
places that can be easily searched.

3.

Lack prompt updating:


Nothing is permanent every thing changes, as time passes on. The same stands true with the system,
which we are talking about, one can imagine, how difficult it is, to alter some information written on
the piece of paper. One way to alter is just cut off and throws away the paper and rewrites the same
information with minor changes on the fresh sheet of paper. Another way is erase the previous

information. Both are disgusting.


13

4.

Lack storing of information:


Information is not information, if it is unordered. In fact it is nothing more than a raw data. To make
data useful we need to store it on various basis like on the basis of Book code, Title id, subject id, etc.,
but imagine how to store information in a manual system.

5.

Redundancy of information:
We have to make transactions with number of book at a number of times. There are always chances of
recording information about the same book number of times. This is redundancy. Redundancy
invites inconsistency. In case some information about a member or book is maintained twice or more
than twice in future, if modification done at one place then how will you be able to decide which of the
various information about the same is correct.

6.

Preparation of accurate and prompt reports :


Preparation of fine report, total number of missing book reports etc. becomes really difficult in a
manual system. Even after hard work if one able to prepare it then it is not guaranteed that the
prepared report is accurate and up to date whereas this is not the case with computerised systems.

User Requirement
Various requirements laid by the user are:
Maintains data about the customers, managers,staff of the hotel.
Arranging data in logical order for easy maintenance.
Collection of data about room which are booked.
Collection of data about room which are free.
Data of room charges on the customers for room boking, damage of goods etc
Generation of various reports according to the management request.

14

Performance of the proposed System


1. Immediate retrieval of information
2. Better storage facility
3. Better sorting of efficient report
4. Quick sorting of information.
5. Preparation of efficient report.
6. Accuracy of data i.e. no redundancy hence no inconsistency.
7. Prompt updating of information.

15

ALTERNATIVE SOLUTIONS EXAMINED


To achieve various goals and sub-goals set above, broadly three solutions where examined. These
solutions are consists of:
1. Specification of information to be made available by the system.
2. Description of what will be done manually and what has to be done by the computer.
3. Specification of the new computer equipments that are required. For each alternative solution
cost and benefit have to be examined before deciding one of the alternatives.

Solution A: -- One can improve existing manual system by carrying out the following steps:
All the related records could be updated as soon as Book is issued . Instead of keeping information at
various places about the books and the members of the library a master register can be made and it
can be kept at the centre place. A data entry staff can be made to sit
at the counter and can be assigned the job of entering all the books details and verifying it at the same
time. He can also be assigned the job of taking out reports regularly on a fixed date. A separate master
file can also be made for the employees and it can also be kept at the centre.

Solution B: -- A transaction file can be maintained in which records related to a particular period can
be kept and after a fixed interval main records could be updated using this transaction file.

Solution C: -- This is an online information system which helps in fast information retrieval of the
books when member request for the issue of book. Various calculations become easy such as
calculation of fine.

16

COST BENEFIT ANALYSIS


A cost benefit analysis is necessary to determine economic feasibility of the proposed system. The
primary objective of cost benefit analysis is to find out whether it is economically worthwhile to invest
in the project. If the return is good, then the project is considered economically worthwhile. Cost
benefit analysis should be done before preparing the proposed system.
Cost benefit analysis is done for all the cost associated with the project. Conceptually, the cost of the
project represents all the items of outlay associated with the project which are associated with long
term funds as well. It is sum of outlays of the following:
-

Hardware :- Pentium iv processor, Printer, UPS


Costs up to RS. 40, 000.00.

Software: - Visual basic 6.0, MS Access


Installation costs near about RS. 1000.00.
-

Cost of Stationary, cd, Electricity & Maintenance is about RS 1500.00

Cost of Operator RS 10,000.00

Benefits of the proposed system:


-

Saving of extra employee for maintaing books, Calculations etc. - about RS 10,000.00

Reduction in wastage & damage of books - RS 10,000.00

Timely information RS 5000.00

Easy Report generation RS 1000.00

17

The whole problem of automating the library is divided into 5 modules project problem will be solved
by making the project in VB.net. Back end is taken oracle.. the brief details of VB.net and oracle are as
follows.
A MDI form is taken in which drop down menus are maintained to solve the problem. Main
menus are as follows
1. Database
2. Transaction
3. Administrator
4. Reports
5. Tools
6. Help

All the forms are declared as child forms of MDI form which will open within the MDI form.
Connectivity to back end MS Access is done through ADO which is operating on a disconnected
Architecture. Data is retrieved into Dataset, which can be manipulated into the database. All the
operation of updation, deletion and addition are maintained through disconnected architecture. Queries
are used for the connectivity.

18

Feasibility study
According to our first (Analysis and information gathering) we have prepared this document .we are
describing how much our system is feasible in the following terms.

1. Economic feasibility
Economical system is providing many tangible and intangible benefits to the user at the reasonable
cost. Considering the cost and benefits analysis & looking towards the benefits & the process the
management of different task in the system cost of a system is reasonable.

2. Technical feasibility
The technical feasibility in terms of hardware \software & other resources used, is able to handle the
different task operation. The selection of hardware\software is done after the considering the system
hierarchy volume of data, system performance, and system security and back up. The cost of hardware
\software is calculated according the feasibility analysis.

3. Behavior feasibility
The performance & installation of system is easy & less time consuming & there is no need to
configure the system the resources that we are using to maintain and to operate the system are
minimal. System security checks the user for unauthorized login. The working environment of our
system is GUI based which is highly user-friendly .So it will take less time to educate the user or user
training.

19

20

PLATFROM: Windows XP (SP2)


Window XP is latest version of windows and also GUI. This is the best then another Operating system
and easy.
Window XP has come up with another bonanza, that is, network Communication with other user. The
users can connect with other users to share data files and peripheral devices, like printers. The
Communication tools of Window XP include E-Mail and connection to Internet.

FRONT END: VISUAL BASIC 6.0


Visual Basic uses front-end programming because VB use back end as like MS-ACCESS, ORACLE,
FOXPRO and any other Database.
In VB we can use easy database connectivity and design the form, Report, and others MDI
applications with the help of database.
VB is used for see the data in many modes such as with the help of MS Flex Grid Controls, Textbox,
combo box, list box, image, picture control and other Visual Basic gives the different types of
accessing the database(RDOAND and DAO).
21

BACK END: MS-ACCESS 2003


MS-access is a data base and partially RDBMS. In access we can easily create database design and
give the validations. Access allows the many types of relations between the tables.
Access used as back end with the visual basic .access allow create the primary key foreign key and
unique key .In access
We can store the data in to the table for using the wizard option.

22

DATA DICTIONARY
Data dictionary is a structured repository of data. It is a list of terms and their definition for all data
items and data stores of a system.
The primary advantages that a data dictionary offers are as follows

Documentation is one of the most obvious advantages of data dictionary. It is a valuable


reference in any origination

It improve analysis / user communication by establishing

Consistence definition of various element, terms and procedure.


During implements it severs as a common base against which programmers compare their data
descriptions.

Programs that use a given data elements are cross- referenced in the data dictionary, which makes it
easy to identify them and make any necessary changes.
A data dictionary is an important step in building data base. Most data base management systems have
a data dictionary as a standard feature.
Following points are considered while constructing a data dictionary
1. Each data flow in the DFD has one data dictionary entry.
2. Definition must be reality accessible by name.
3. There should be no redundancy in the data definition.
4. The procedure for writing definitions should be precise.

23

DEVELOPMENT OF SOFTWARE
Software development depends upon the
*Cost of each option
*the time available to write software, and
*the availability of programmers
Starting coding of any subsystem we were required to study information and requirements regarding
that application, stored in MS-ACCESS Dictionary. once the problem is well thought off ,and ideas
were shared/ discussed among other team members, design phase is through i.e how exactly the user
interface will be and what is the best way to deduce the logic of the application , we were required
to write
document

down the flows of logic and other parameters being used or getting affected on a
of COMPUTERIZED HOTEL MANAGEMENT

SYSTEM called Requirement

Specification Document .
The RSD has to get approved us and used to get further suggestions, also this RDS is used to prepare
the documentation of the system at latter and helps to the changes in the logic.

24

25

LOGIN FORM

Login form to check authorized user

26

MAIN MENU (MDI)

Main menu to access system muduls

27

RESERVATION

form to reserve a room for a customer.

28

Check In

To check room availibility in the hotel

29

Edit guests information

To modify the guest information

30

Payment

To get payment from the customer.

31

Check out information

To check total numbers of reserve rooms in hotel.

32

Add new employee

Form to add new employee.

33

Edit employee record

A form to edit the employee record.

34

Delete record

From to delete the employee record.

35

Employee payroll

To management the salary of employee.

36

Searching guests

A form to Search an guest.

37

Search employee

To Search an employee.

38

Status of hotel

To get the right status of hotel.

39

List of rooms

To check the total numbers of room available in the hotel.

40

Add new user

To add new user

41

42

Rooms
Field Name
TitleOfrooms
Author
VolumeNumber
Publisher
SubjectName
RecevingDate
Availability
LostStatus

Data Type
Text
Text
Text
Text
Number
Date/Time
Yes/No
Yes/No

43

Issue Register
Field name
MemberID
IssueDate
ReturnDate
ExtraDays
Penalty
Currency
Satus

Data type
Number
Date/Time
Date/Time
Number
Currency
Text
Yes/No

44

Lost book
Field Name
bookID
LossDate
Reason
ResponsiablePerson
AuthorizedPerson

Data Type
Number
Date/Time
Text
Text
Text

45

Members table
Field Name
MemberID
NameOfMember
CNICNumber
DateOfBirth
DateOfJoining
ContactNumber
MailingAddress
GAddress
Garaunter
MembershipType
Status

Data Type
AutoNumber
Text
Text
Date/Time
Date/Time
Text
Text
Text
Text
Number
Yes/No

46

Penalty
Field Name
PenaltyID
MemberID
BookID
PenaltyDate
PenaltyType
PenaltyAmount
Remarks

Data Type
AutoNumber
Number
AutoNumber
Date/Time
Number
Number
Text

47

Users
Field Name
UserID
LoginID
Password
UserType
UserName
DateOfJoining
ExpeiringDate
Status

Data Type
AutoNumber
Text
Text
Text
Text
Date/Time
Date/Time
Yes/No

48

49

FrmLogin
Private Sub cmdExit_Click()
End
End Sub
Private Sub cmdLogin_Click()
Query = "Select * From Users Where LoginID='" & txtLoginID & "' and Password = '" &
txtPassword & "'"
Set reSet = myCon.Execute(Query)
If (Not reSet.BOF) And (Not reSet.EOF) Then
UserName = reSet.Fields("UserName").Value
Unload Me
frmMain.Show
Else
If Counter >= 3 Then
MsgBox "Abnormal Termination of the Program. System assumes that You are not an
authorized user of the eLibrary System. Only three attempts are allowed.", vbCritical, "Abnormal
Termination!"
End
Else
MsgBox "Invalid User Name / Password! Please enter the correct information.",
vbInformation, "Invalid User Name / Password"
txtLoginID.Text = ""
txtPassword.Text = ""
txtLoginID.SetFocus
Counter = Counter + 1
End If
End If
End Sub
Private Sub Form_Load()
50

myCon.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=LMS.mdb;Persist


Security Info=False"
myCon.Open
Counter = 1
End Sub
Private Sub Form_Unload(Cancel As Integer)
myCon.Close
Set reSet = Nothing
End Sub
Private Sub txtLoginID_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then txtPassword.SetFocus
End Sub
Private Sub txtPassword_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then cmdLogin.SetFocus
End Sub

51

FrmMdi
Private Sub About_Click()
frmAbout.Show
End Sub
Private Sub Add_Book_Click()
On Error Resume Next
frmAdd.MainTabAdd.Tab = 0
frmAdd.Show 1, frmMain
End Sub
Private Sub Add_Member_Click()
On Error Resume Next
frmAdd.MainTabAdd.Tab = 1
frmAdd.Show 1, frmMain
End Sub
Private Sub Add_Penalty_Click()
On Error Resume Next
frmBorrower.MainTabBorrower.Tab = 1
frmBorrower.Show 1, frmMain
End Sub
Private Sub Add_Penalty_Type_Click()
End Sub
Private Sub Add_User_Click()
frmAdd.Show
End Sub
Private Sub Books_Register_Click()
On Error Resume Next
52

rptAllBooks.Show 1, frmMain
End Sub
Private Sub Borrowers_Register_Click()
On Error Resume Next
rptAllBorrowers.Show 1, frmMain
End Sub
Private Sub Change_Borrower_Click()
On Error Resume Next
frmEdit.MainTabEdit.Tab = 2
frmEdit.Show 1, frmMain
End Sub
Private Sub Edit_Book_Click()
On Error Resume Next
frmEdit.MainTabEdit.Tab = 0
frmEdit.Show 1, frmMain
End Sub
Private Sub Edit_Member_Click()
On Error Resume Next
frmEdit.MainTabEdit.Tab = 1
frmEdit.Show 1, frmMain
End Sub
Private Sub Issue_Book_Click()
On Error Resume Next
frmAdd.MainTabAdd.Tab = 2
frmAdd.Show 1, frmMain
End Sub
Private Sub Log_Off_Click()
53

Confirmation = MsgBox("Are you sure you want to Log Off?", vbYesNoCancel + vbQuestion, "Log
Off")
If Confirmation = vbYes Then
UserName = ""
Unload Me
frmLogin.Show
End If
End Sub

Private Sub Loss_Book_Click()


frmBorrower.MainTabBorrower.TabIndex = 2
End Sub
Private Sub Members_Register_Click()
On Error Resume Next
rptAllMembers.Show 1, frmMain
End Sub
Private Sub Penalty_Register_Click()
On Error Resume Next
rptPenalty.Show 1, frmMain
End Sub
Private Sub Penalty_Types_Click()
On Error Resume Next
rptPenaltyTypes.Show 1, frmMain
End Sub
Private Sub Print_All_Book_Click()
On Error Resume Next
rptAllBooks.Show 1, frmMain
End Sub
54

Private Sub Print_All_Borrowers_Click()


On Error Resume Next
rptAllBorrowers.Show 1, frmMain
End Sub
Private Sub Print_All_Members_Click()
On Error Resume Next
rptAllMembers.Show 1, frmMain
End Sub
Private Sub Print_Single_Book_Click()
On Error Resume Next
frmEdit.MainTabEdit.Tab = 0
frmEdit.Show 1, frmMain
End Sub
Private Sub Print_Single_Borrower_Click()
On Error Resume Next
frmEdit.MainTabEdit.Tab = 2
frmEdit.Show 1, frmMain
End Sub
Private Sub Print_Single_Member_Click()
On Error Resume Next
frmEdit.MainTabEdit.Tab = 1
frmEdit.Show 1, frmMain
End Sub
Private Sub Quit_Click()
Confirmation = MsgBox("Are you sure you want to Quit?", vbYesNoCancel + vbQuestion, "Quit")
If Confirmation = vbYes Then
UserName = ""
55

End
End If
End Sub
Private Sub Return_Book_Click()
On Error Resume Next
frmBorrower.MainTabBorrower.Tab = 0
frmBorrower.Show 1, frmMain
End Sub
Private Sub Search_Member_Click()
On Error Resume Next
frmEdit.MainTabEdit.Tab = 1
frmEdit.Show 1, frmMain
End Sub
Private Sub Show_Borrowera_Click()
On Error Resume Next
frmBorrower.MainTabBorrower.Tab = 2
frmBorrower.Show 1, frmMain
End Sub
Private Sub Single_Book_Click()
On Error Resume Next
frmEdit.MainTabEdit.Tab = 0
frmEdit.Show 1, frmMain
End Sub
Private Sub Single_Borrower_Click()
On Error Resume Next
frmEdit.MainTabEdit.Tab = 2
frmEdit.Show 1, frmMain
End Sub
56

Private Sub Single_Member_Click()


On Error Resume Next
frmEdit.MainTabEdit.Tab = 1
frmEdit.Show 1, frmMain
End Sub

57

FrmEdit
Private Sub cmcmdMemUpdate_Click()
On Error Resume Next
myCon.Execute "Update Members Set NameOfMember = '" & txtMemName.Text & "' Where
MemberID = " & txtSMemberID
myCon.Execute "Update Members Set FatherName = '" & txtMemFName.Text & "' Where
MemberID = " & txtSMemberID
myCon.Execute "Update Members Set CNICNumber = '" & txtCNIC.Text & "' Where MemberID =
" & txtSMemberID
myCon.Execute "Update Members Set DateOfBirth = '" & CDate(dtpDoBirth.Value) & "' Where
MemberID = " & txtSMemberID
myCon.Execute "Update Members Set DateOfJoining = '" & CDate(dtpDoJoin.Value) & "' Where
MemberID = " & txtSMemberID
myCon.Execute "Update Members Set ContactNumber = '" & txtMemContact.Text & "' Where
MemberID = " & txtSMemberID
myCon.Execute "Update Members Set MailingAddress = '" & txtMemAddress.Text & "' Where
MemberID = " & txtSMemberID
myCon.Execute "Update Members Set Guaranteer = '" & txtGuaranteer.Text & "' Where MemberID
= " & txtSMemberID
myCon.Execute "Update Members Set GAddress = '" & txtGAddress.Text & "' Where MemberID =
" & txtSMemberID
myCon.Execute "Update Members Set MembershipType = " & CDbl(cmbMemType.ListIndex + 1)
& " Where MemberID = " & txtSMemberID
If cmbMemStatus.ListIndex = 0 Then
myCon.Execute "Update Members Set Status = -1 Where MemberID = " & txtSMemberID
Else
myCon.Execute "Update Members Set Status = 0 Where MemberID = " & txtSMemberID
End If
Adodc2.Recordset.Requery
Adodc2.Refresh
MembersGrid.Refresh
58

MsgBox "1 Record has been Updated in the Members Register", vbInformation, "Congratulations!"
Call ClearMemeberDetails
End Sub
Private Sub cmdAddBook_Click()
Call ClearBookDetails
End Sub
Private Sub cmdBPrint_Click()
On Error Resume Next
deLMS.rsqrySingleBook.Filter = "BookID = " & CDbl(txtSBookID.Text)
rptSingleBook.Show 1, frmMain
End Sub
Private Sub cmdBrPrint_Click()
On Error Resume Next
deLMS.rsqrySingleBorrower.Filter = "BookID = " & CDbl(txtBBookID.Text)
rptSingleBorrower.Show 1, frmMain
End Sub
Private Sub cmdClearBorrower_Click()
MsgBox "Sorry for Inconvenience! This feature is nor working at the moment.", vbInformation,
"Feature Not Applicapable"
End Sub
Private Sub cmdExirBorrower_Click()
Unload Me
End Sub
Private Sub cmdExit_Click()
Unload Me
59

End Sub
Private Sub cmdMemClear_Click()
Call ClearMemeberDetails
End Sub
Private Sub cmdMemExit_Click()
Unload Me
End Sub
Private Sub cmdMemSearch_Click()
On Error Resume Next
If Trim(txtSMemberID.Text) = "" Then
MsgBox "Invalid Member ID. Please enter a Valid Member ID!", vbInformation, "Invalid
Member ID"
Call ClearBookDetails
Exit Sub
End If
Query = "Select * From Members Where MemberID = " & CDbl(txtSMemberID)
Set reSet = myCon.Execute(Query)
If (Not reSet.BOF) And (Not reSet.EOF) Then
txtMemberID.Text = reSet.Fields("MemberID").Value
txtMemName.Text = reSet.Fields("NameOfMember").Value
txtMemFName.Text = reSet.Fields("FatherName").Value
txtCNIC.Text = reSet.Fields("CNICNumber").Value
dtpDoBirth.Value = CDate(reSet.Fields("DateOfBirth").Value)
dtpDoJoin.Value = CDate(reSet.Fields("DateOfJoining").Value)
txtMemContact.Text = reSet.Fields("ContactNumber").Value
txtMemAddress.Text = reSet.Fields("MailingAddress").Value
60

txtGuaranteer.Text = reSet.Fields("Guaranteer").Value
txtGAddress.Text = reSet.Fields("GAddress").Value
cmbMemType.ListIndex = reSet.Fields("MembershipType").Value
If reSet.Fields("Status").Value = CBool(-1) Then
cmbMemStatus.ListIndex = 0
Else
cmbMemStatus.ListIndex = 1
End If
Else
MsgBox "Invalid Member ID. Please enter a Valid MemberID!", vbInformation, "Invalid
Member ID"
Call ClearMemeberDetails
End If
End Sub
Private Sub cmdPrint_Click()
On Error Resume Next
deLMS.rsqrySingleMember.Filter = "MemberID = " & CDbl(txtSMemberID.Text)
rptSingleMember.Show 1, frmMain
End Sub
Private Sub cmdSaveBook_Click()
myCon.Execute "Update Books Set TitleOfBook = '" & txtTitle.Text & "' Where BookID = " &
txtSBookID
myCon.Execute "Update Books Set Author = '" & txtAuthor.Text & "' Where BookID = " &
txtSBookID
myCon.Execute "Update Books Set ISBNNumber = '" & txtISBN.Text & "' Where BookID = " &
txtSBookID
myCon.Execute "Update Books Set VolumeNumber = '" & txtVolume.Text & "' Where BookID = " &
txtSBookID
61

myCon.Execute "Update Books Set Publisher = '" & txtPublisher.Text & "' Where BookID = " &
txtSBookID
myCon.Execute "Update Books Set SubjectName = " & (cmbBookSubjects.ListIndex + 1) & " Where
BookID = " & txtSBookID
myCon.Execute "Update Books Set RecevingDate = '" & CDate(dtpRecDate.Value) & "' Where
BookID = " & txtSBookID
If cmbBookStatus.ListIndex = 0 Then
myCon.Execute "Update Books Set Availability = -1 Where BookID = " & txtSBookID
Else
myCon.Execute "Update Books Set Availability = 0 Where BookID = " & txtSBookID
End If
Adodc1.Refresh
BooksGrid.Refresh
MsgBox "1 Record has been Updated in the Books Register", vbInformation, "Congratulations!"
Call ClearBookDetails
End Sub
Private Sub cmdSearch_Click()
On Error Resume Next
If Trim(txtSBookID.Text) = "" Then
MsgBox "Invalid Book ID. Please enter a Valid Book ID!", vbInformation, "Invalid Book ID"
Call ClearBookDetails
Exit Sub
End If
Query = "Select * From Books Where BookID = " & CDbl(txtSBookID)
Set reSet = myCon.Execute(Query)
62

If (Not reSet.BOF) And (Not reSet.EOF) Then


txtBookID.Text = reSet.Fields(0).Value
txtTitle.Text = reSet.Fields(1).Value
txtAuthor.Text = reSet.Fields(2).Value
txtISBN.Text = reSet.Fields(3).Value
txtVolume.Text = reSet.Fields(4).Value
txtPublisher.Text = reSet.Fields(5).Value
cmbBookSubjects.ListIndex = reSet.Fields(6).Value
dtpRecDate.Value = reSet.Fields(7).Value
If reSet.Fields(8).Value = -1 Then
cmbBookStatus.ListIndex = 0
Else
cmbBookStatus.ListIndex = 1
End If
Else
MsgBox "Invalid Book ID. Please enter a Valid Book ID!", vbInformation, "Invalid Book ID"
Call ClearBookDetails
End If
End Sub
Private Sub cmdSearchBorrower_Click()
On Error Resume Next
Query = "Select * From IssueRegister Where BookID = " & CDbl(txtBBookID.Text) & "And Status
= -1"
Set reSet = myCon.Execute(Query)
If (Not reSet.BOF) And (Not reSet.EOF) Then
txtBMemberID.Text = reSet.Fields("MemberID").Value
dtpIssuanceDate.Value = reSet.Fields("IssueDate").Value
Else
MsgBox "Invalid Book ID. Please enter a Valid Book ID!", vbInformation, "Invalid BookID"
63

Call ClearBorroewer
End If
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Query = "Select * From Books Where BookID=" & CDbl(txtBBookID.Text)
Set reSet = myCon.Execute(Query)
If (Not reSet.BOF) And (Not reSet.EOF) Then
txtBookTitle001.Text = reSet.Fields("TitleOfBook").Value
txtAuthor001.Text = reSet.Fields("Author").Value
txtISBN001.Text = reSet.Fields("ISBNNumber").Value
txtVolume001.Text = reSet.Fields("VolumeNumber").Value
txtPublisher001.Text = reSet.Fields("Publisher").Value
txtRecDate001.Text = reSet.Fields("RecevingDate").Value
txtStatus001.Text = reSet.Fields("Availability").Value
End If
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Query = "Select * From Members Where MemberID =" & CDbl(txtBMemberID.Text)
Set reSet = myCon.Execute(Query)
If (Not reSet.BOF) And (Not reSet.EOF) Then
txtMemName001.Text = reSet.Fields("NameOfMember").Value
txtDoJoining001.Text = reSet.Fields("DateOfJoining").Value
txtContact001.Text = reSet.Fields("ContactNumber").Value
txtMemStatus001.Text = reSet.Fields("Status").Value
End If
End Sub
Private Sub cmdUpdateBorrower_Click()
64

myCon.Execute "Update IssueRegister Set MemberID = " & txtBMemberID.Text & " Where
BookID = " & txtBBookID.Text & " And Status = -1"
myCon.Execute "Update IssueRegister Set IssueDate = '" & CDate(dtpIssuanceDate.Value) & "'
Where BookID = " & txtBBookID.Text & " And Status = -1"
MsgBox "1 Record has been Updated in the Members Register", vbInformation, "Congratulations!"
Call ClearBorroewer
End Sub
Private Sub Form_Load()
On Error Resume Next
myCon.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=LMS.mdb;Persist
Security Info=False"
myCon.Open
Counter = 0
Call SetBookSubjects
Call SetBookStatus
Call SetMemberships
Call SetMemberStatus
Call ClearBorroewer
End Sub
Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
myCon.Close
Set reSet = Nothing
End Sub
Private Sub SetBookSubjects()
cmbBookSubjects.Clear
Set reSet = myCon.Execute("Select * From Subjects")
While Not reSet.EOF
65

cmbBookSubjects.AddItem reSet.Fields("NameOfSubject")
reSet.MoveNext
Wend
End Sub
Private Sub SetBookStatus()
cmbBookStatus.Clear
cmbBookStatus.AddItem "Available"
cmbBookStatus.AddItem "Not Available"
End Sub
Private Sub ClearBookDetails()
txtSBookID.Text = ""
txtBookID.Text = ""
txtTitle.Text = ""
txtAuthor.Text = ""
txtISBN.Text = ""
txtVolume.Text = ""
txtPublisher.Text = ""
dtpRecDate.Value = Now()
txtSBookID.SetFocus
End Sub
Private Sub ClearMemeberDetails()
txtSMemberID.Text = ""
txtMemberID.Text = ""
txtMemName.Text = ""
txtMemFName.Text = ""
txtCNIC.Text = ""
dtpDoBirth.Value = Now()
dtpDoJoin.Value = Now()
txtGuaranteer.Text = ""
txtGAddress.Text = ""
66

cmbMemType.ListIndex = 1
cmbMemStatus.ListIndex = 0
txtSMemberID.SetFocus
End Sub
Private Sub SetMemberStatus()
cmbMemStatus.Clear
cmbMemStatus.AddItem "Active"
cmbMemStatus.AddItem "Inactive"
End Sub
Private Sub SetMemberships()
cmbMemType.Clear
Set reSet = myCon.Execute("Select * From Membership")
While Not reSet.EOF
cmbMemType.AddItem reSet.Fields("Type")
reSet.MoveNext
Wend
End Sub
Private Sub ClearBorroewer()
txtBBookID.Text = ""
txtBMemberID.Text = ""
txtStatus001.Text = ""
txtMemStatus001.Text = ""
dtpIssuanceDate.Value = Now()
txtBBookID.SetFocus
End Sub
Private Sub txtMemStatus001_Change()
If txtMemStatus001.Text = "False" Then
txtMemStatus001.BackColor = vbRed
ElseIf txtMemStatus001.Text = "True" Then
67

txtMemStatus001.BackColor = vbGreen
Else
txtMemStatus001.BackColor = &H80000005
End If
End Sub
Private Sub txtStatus001_Change()
If txtStatus001.Text = "False" Then
txtStatus001.BackColor = vbRed
ElseIf txtStatus001.Text = "True" Then
txtStatus001.BackColor = vbGreen
Else
txtStatus001.BackColor = &H80000005
End If
End Sub

68

FrmBorrowers
Private Sub cmdLExit_Click()
Unload Me
End Sub
Private Sub cmdPClear_Click()
txtMID.Text = ""
txtBID.Text = ""
txtPAmount.Text = ""
txtRemarks.Text = ""
dtpPDate.Value = Now()
cmbPType.ListIndex = 0
txtMID.SetFocus
End Sub
Private Sub cmdPExit_Click()
Unload Me
End Sub
Private Sub cmdPUpdate_Click()
Query = "Insert Into Penalty (MemberID, BookID, PenaltyDate, PenaltyType, PenaltyAmount,
Remarks) Values (" _
& CDbl(txtMID.Text) & ", " _
& CDbl(txtBID.Text) & ", " _
& "'" & CDate(dtpPDate.Value) & "', " _
& cmbPType.ListIndex & ", " _
& CDbl(txtPAmount.Text) & ", " _
& "'" & txtRemarks.Text & "')"
myCon.Execute Query
Adodc2.Recordset.Update
Adodc2.Refresh
69

' Refresh the Grid Data


DataGrid2.Refresh
MsgBox "1 Record has been saved in the Penalty Register", vbInformation, "Congratulations!"
Call cmdPClear_Click
End Sub
Private Sub cmdRClear_Click()
txtRBookID.Text = ""
txtRMemberID.Text = ""
txtRIssueDate.Text = ""
txtExtraDays.Text = ""
txtPenalty.Text = ""
dtpRetDate.Value = Now()
txtBookTitle001.Text = ""
txtAuthor001.Text = ""
txtISBN001.Text = ""
txtVolume001.Text = ""
txtPublisher001.Text = ""
txtRecDate001.Text = ""
txtStatus001.Text = ""
txtMemName001.Text = ""
txtDoJoining001.Text = ""
txtContact001.Text = ""
txtMemStatus001.Text = ""
txtRBookID.SetFocus
End Sub
Private Sub cmdRExit_Click()
70

Unload Me
End Sub
Private Sub cmdRSearch_Click()
On Error Resume Next
Query = "Select * From IssueRegister Where BookID =" & CDbl(txtRBookID.Text) & " And Status
= -1"
Set reSet = myCon.Execute(Query)
If (Not reSet.BOF) And (Not reSet.EOF) Then
txtRMemberID.Text = reSet.Fields("MemberID").Value
txtRIssueDate.Text = reSet.Fields("IssueDate").Value
If (CDate(dtpRetDate.Value) - CDate(txtRIssueDate.Text)) > 30 Then
txtExtraDays.Text = CInt((CDate(dtpRetDate.Value) - CDate(txtRIssueDate.Text)) - 30)
txtPenalty.Text = CInt(50 * CDbl(txtExtraDays.Text))
Else
txtExtraDays.Text = 0
txtPenalty.Text = 0
End If
Else
MsgBox "Invalid Book ID. Please enter a Valid Book ID!", vbInformation, "Invalid BookID"
Call cmdRClear_Click
Resume Next
Exit Sub
End If
'''''''''''''''''''''''''''''''''''''''''''''''''''''''
Query = "Select * From Books Where BookID=" & CDbl(txtRBookID.Text)
Set reSet = myCon.Execute(Query)
71

If (Not reSet.BOF) And (Not reSet.EOF) Then


txtBookTitle001.Text = reSet.Fields("TitleOfBook").Value
txtAuthor001.Text = reSet.Fields("Author").Value
txtISBN001.Text = reSet.Fields("ISBNNumber").Value
txtVolume001.Text = reSet.Fields("VolumeNumber").Value
txtPublisher001.Text = reSet.Fields("Publisher").Value
txtRecDate001.Text = reSet.Fields("RecevingDate").Value
txtStatus001.Text = reSet.Fields("Availability").Value
End If
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Query = "Select * From Members Where MemberID =" & CDbl(txtRMemberID.Text)
Set reSet = myCon.Execute(Query)
If (Not reSet.BOF) And (Not reSet.EOF) Then
txtMemName001.Text = reSet.Fields("NameOfMember").Value
txtDoJoining001.Text = reSet.Fields("DateOfJoining").Value
txtContact001.Text = reSet.Fields("ContactNumber").Value
txtMemStatus001.Text = reSet.Fields("Status").Value
End If
End Sub
Private Sub cmdRUpdate_Click()
On Error Resume Next
myCon.Execute "Update IssueRegister Set ReturnDate = '" & CDate(dtpRetDate.Value) & "' Where
BookID = " & txtRBookID.Text & " And Status = -1"
myCon.Execute "Update IssueRegister Set ExtraDays = " & CDbl(txtExtraDays.Text) & " Where
BookID = " & txtRBookID.Text & " And Status = -1"
myCon.Execute "Update IssueRegister Set Penalty = " & CDbl(txtPenalty.Text) & " Where BookID
= " & txtRBookID.Text & " And Status = -1"
myCon.Execute "Update IssueRegister Set Status = 0 Where BookID = " & txtRBookID.Text & "
And Status = -1"
72

If Val(txtPenalty.Text) > 0 Then


Query = "Insert Into Penalty(MemberID, BookID, PenaltyDate, PenaltyType, PenaltyAmount,
Remarks) Values(" _
& CDbl(txtRMemberID.Text) & ", " _
& CDbl(txtRBookID.Text) & ", " _
& "'" & Now() & "', " _
& CDbl("0") & ", " _
& CDbl(txtPenalty.Text) & ", " _
& "'Late Submission of Book')"
myCon.Execute Query
End If
Adodc1.Recordset.Update
Adodc1.Refresh
' Refresh the Grid Data
BooksGrid.Refresh
MsgBox "1 Record has been saved in the Issue Books Register", vbInformation, "Congratulations!"
Call cmdRClear_Click
End Sub
Private Sub dtpRetDate_Change()
txtExtraDays.Text = CDate(dtpRetDate.Value) - CDate(txtRIssueDate.Text)
If (CDate(dtpRetDate.Value) - CDate(txtRIssueDate.Text)) > 30 Then
txtExtraDays.Text = CInt((CDate(dtpRetDate.Value) - CDate(txtRIssueDate.Text)) - 30)
txtPenalty.Text = CInt(50 * CDbl(txtExtraDays.Text))
Else
txtExtraDays.Text = 0
txtPenalty.Text = 0
End If
73

End Sub
Private Sub Form_Load()
On Error Resume Next
myCon.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=LMS.mdb;Persist
Security Info=False"
myCon.Open
Call cmdRClear_Click
Call SetPenaltyID
Call SetPenaltyTypes
End Sub
Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
myCon.Close
Set reSet = Nothing
End Sub
Private Sub SetPenaltyID()
Counter = 1
' To Set the Penalty ID
Set reSet = myCon.Execute("Select * From Penalty")
While Not reSet.EOF
Counter = Counter + 1
reSet.MoveNext
Wend
txtPID.Text = Counter
' To clear the Input Fields of the Form
'Call cmdPClear_Click
End Sub
74

Private Sub SetPenaltyTypes()


' To Set the Penalty Types
cmbPType.Clear
Set reSet = myCon.Execute("Select * From PenaltyTypes")
While Not reSet.EOF
cmbPType.AddItem reSet.Fields("Description")
reSet.MoveNext
Wend
cmbPType.ListIndex = 0
txtMID.SetFocus
End Sub
Private Sub txtBID_LostFocus()
Query = "Select * From Books Where BookID=" & CDbl(txtBID.Text)
Set reSet = myCon.Execute(Query)
If (Not reSet.BOF) And (Not reSet.EOF) Then
txtBookTitle002.Text = reSet.Fields("TitleOfBook").Value
txtAuthor002.Text = reSet.Fields("Author").Value
txtISBN002.Text = reSet.Fields("ISBNNumber").Value
txtVolume002.Text = reSet.Fields("VolumeNumber").Value
txtPublisher002.Text = reSet.Fields("Publisher").Value
txtRecDate002.Text = reSet.Fields("RecevingDate").Value
txtStatus002.Text = reSet.Fields("Availability").Value
End If
End Sub
Private Sub txtMID_LostFocus()
On Error Resume Next
Query = "Select * From Members Where MemberID =" & CDbl(txtMID.Text)
75

Set reSet = myCon.Execute(Query)


If (Not reSet.BOF) And (Not reSet.EOF) Then
txtMemName002.Text = reSet.Fields("NameOfMember").Value
txtDoJoining002.Text = reSet.Fields("DateOfJoining").Value
txtContact002.Text = reSet.Fields("ContactNumber").Value
txtMemStatus002.Text = reSet.Fields("Status").Value
Else
MsgBox "Invalid Member ID. Please enter a Valid Member ID!", vbInformation, "Invalid
Member ID"
End If
End Sub

76

FrmAdd
Private Sub cmdAddBook_Click()
Call SetBookID
Call SetSubjects
Call SetBookStatus
End Sub
Private Sub cmdAddMember_Click()
Call SetMemberID
Call SetMemberTypes
Call SetMemberStatus
End Sub
Private Sub cmdExit_Click()
Unload Me
End Sub
Private Sub cmdExitMember_Click()
Unload Me
End Sub
Private Sub cmdIssueBook_Click()
txtBBookID.Text = ""
txtBMemberID.Text = ""
End Sub
Private Sub cmdSaveBook_Click()
Adodc1.Recordset.AddNew
Adodc1.Recordset.Fields("TitleOfBook") = txtTitle.Text
Adodc1.Recordset.Fields("Author") = txtAuthor.Text
Adodc1.Recordset.Fields("ISBNNumber") = txtISBN.Text
Adodc1.Recordset.Fields("VolumeNumber") = txtVolume.Text
77

Adodc1.Recordset.Fields("Publisher") = txtPublisher.Text
Adodc1.Recordset.Fields("VolumeNumber") = txtVolume.Text
Adodc1.Recordset.Fields("SubjectName") = cmbSubjects.ListIndex + 1
Adodc1.Recordset.Fields("RecevingDate") = CDate(dtpRecDate.Month & "/" & dtpRecDate.Day &
"/" & dtpRecDate.Year)
If cmbStatus.ListIndex = 0 Then
Adodc1.Recordset.Fields("Availability") = -1
Else
Adodc1.Recordset.Fields("Availability") = -1
End If
Adodc1.Recordset.Update
Adodc1.Refresh
' Refresh the Grid Data
BooksGrid.Refresh
' Refreshes the Data in Form
' Call cmdAddBook_Click
frmAdd.Refresh
Call SetBookID
MsgBox "1 Record has been saved in the Books Register", vbInformation, "Congratulations!"
End Sub

Private Sub cmdSaveIssuedBook_Click()


On Error Resume Next
Query = "Select * From IssueRegister Where BookID = " & CDbl(txtBBookID.Text) & "And Status
= -1"
Set reSet = myCon.Execute(Query)
78

If (Not reSet.BOF) And (Not reSet.EOF) Then


MsgBox "This Book has already been issued to someone else. Please choose another book",
vbInformation, "Invalid BookID"
Call ClearBookInfo
Exit Sub
End If
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Query = "Insert Into IssueRegister (BookID, MemberID, IssueDate) Values(" _
& txtBBookID.Text & _
", " & txtBMemberID.Text & _
", '" & CDate(dtpIssuanceDate.Month & "/" & dtpIssuanceDate.Day & "/" &
dtpIssuanceDate.Year) & "')"
myCon.Execute Query
myCon.Execute "Update IssueRegister Set Status = -1 Where BookID = " & txtBBookID.Text
MsgBox "1 Record has been Saved in the Issue Register", vbInformation, "Congratulations!"
myCon.Execute "Update Books Set Availability = 0 Where BookID = " & txtBBookID.Text
MsgBox "1 Record has been Updated in the Books Register", vbInformation, "Congratulations!"
Call ClearBookInfo
End Sub
Private Sub cmdSaveMember_Click()
Adodc2.Recordset.AddNew
Adodc2.Recordset.Fields("NameOfMember") = txtMemName.Text
Adodc2.Recordset.Fields("FatherName") = txtMemFName.Text
Adodc2.Recordset.Fields("CNICNumber") = txtCNIC.Text
Adodc2.Recordset.Fields("DateOfBirth") = CDate(dtpDoBirth.Month & "/" & dtpDoBirth.Day &
"/" & dtpDoBirth.Year)
79

Adodc2.Recordset.Fields("DateOfJoining") = CDate(dtpDoJoin.Month & "/" & dtpDoJoin.Day &


"/" & dtpDoJoin.Year)
Adodc2.Recordset.Fields("ContactNumber") = txtMemContact.Text
Adodc2.Recordset.Fields("MailingAddress") = txtMemAddress.Text
Adodc2.Recordset.Fields("Guaranteer") = txtGuaranteer.Text
Adodc2.Recordset.Fields("GAddress") = txtGAddress.Text
Adodc2.Recordset.Fields("MembershipType") = cmbMemType.ListIndex + 1
If cmbMemStatus.ListIndex = 0 Then
Adodc2.Recordset.Fields("Status") = -1
Else
Adodc2.Recordset.Fields("Status") = 0
End If
Adodc2.Recordset.Update
Adodc2.Refresh
' Refresh the Grid Data
MembersGrid.Refresh
MsgBox "1 Record has been saved in the Books Register", vbInformation, "Congratulations!"
Call SetMemberID
End Sub
Private Sub Command1_Click()
Unload Me
End Sub
Private Sub Form_Load()
On Error Resume Next
myCon.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=LMS.mdb;Persist
Security Info=False"
myCon.Open
Counter = 0
Call cmdAddBook_Click
80

Call cmdAddMember_Click
Call cmdIssueBook_Click
Call ClearBookInfo
End Sub
Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
myCon.Close
Set reSet = Nothing
End Sub
Private Sub SetBookID()
On Error Resume Next
' To clear the Input Fields of the Form
txtTitle.Text = ""
txtAuthor.Text = ""
txtISBN.Text = ""
txtVolume.Text = ""
txtPublisher.Text = ""
Counter = 1
' To Set the Book ID
Set reSet = Nothing
Set reSet = myCon.Execute("Select * From Books")
reSet.MoveLast
While Not reSet.EOF
Counter = Counter + 1
reSet.MoveNext
Wend
txtBookID.Text = reSet.Fields(0) + 1
End Sub
Private Sub SetSubjects()
81

' To Set the Subjects


cmbSubjects.Clear
Set reSet = myCon.Execute("Select * From Subjects")
While Not reSet.EOF
cmbSubjects.AddItem reSet.Fields("NameOfSubject")
reSet.MoveNext
Wend
cmbSubjects.ListIndex = 0
End Sub
Private Sub SetBookStatus()
' To Set the Status
cmbStatus.Clear
cmbStatus.AddItem "Available"
cmbStatus.AddItem "Not Available"
cmbStatus.ListIndex = 0
End Sub
Private Sub SetMemberID()
' To clear the Input Fields of the Form
txtMemName.Text = ""
txtMemFName.Text = ""
txtCNIC.Text = ""
txtMemContact.Text = ""
txtMemAddress.Text = ""
txtGuaranteer.Text = ""
txtGAddress.Text = ""
Counter = 1
' To Set the Book ID
Set reSet = Nothing
Set reSet = myCon.Execute("Select * From Members")
While Not reSet.EOF
82

Counter = Counter + 1
reSet.MoveNext
Wend
txtMemberID.Text = Counter
End Sub
Private Sub SetMemberStatus()
' To Set the Status
cmbMemStatus.Clear
cmbMemStatus.AddItem "Available"
cmbMemStatus.AddItem "Not Available"
cmbMemStatus.ListIndex = 0
End Sub
Private Sub SetMemberTypes()
' To Set the Subjects
cmbMemType.Clear
Set reSet = myCon.Execute("Select * From Membership")
While Not reSet.EOF
cmbMemType.AddItem reSet.Fields("Type")
reSet.MoveNext
Wend
cmbMemType.ListIndex = 1
End Sub

Private Sub txtBBookID_LostFocus()


On Error Resume Next
Query = "Select * From Books Where BookID=" & CDbl(txtBBookID.Text)
Set reSet = myCon.Execute(Query)
If (Not reSet.BOF) And (Not reSet.EOF) Then
83

txtBookTitle001.Text = reSet.Fields("TitleOfBook").Value
txtAuthor001.Text = reSet.Fields("Author").Value
txtISBN001.Text = reSet.Fields("ISBNNumber").Value
txtVolume001.Text = reSet.Fields("VolumeNumber").Value
txtPublisher001.Text = reSet.Fields("Publisher").Value
txtRecDate001.Text = reSet.Fields("RecevingDate").Value
txtStatus001.Text = reSet.Fields("Availability").Value
Else
MsgBox "Invalid Book ID. Please enter a Valid Book ID!", vbInformation, "Invalid Book ID"
End If
End Sub
Private Sub txtBMemberID_LostFocus()
On Error Resume Next
Query = "Select * From Members Where MemberID =" & CDbl(txtBMemberID.Text)
Set reSet = myCon.Execute(Query)
If (Not reSet.BOF) And (Not reSet.EOF) Then
txtMemName001.Text = reSet.Fields("NameOfMember").Value
txtDoJoining001.Text = reSet.Fields("DateOfJoining").Value
txtContact001.Text = reSet.Fields("ContactNumber").Value
txtMemStatus001.Text = reSet.Fields("Status").Value
Else
MsgBox "Invalid Member ID. Please enter a Valid Member ID!", vbInformation, "Invalid
Member ID"
'txtBMemberID.Text = ""
'txtBMemberID.SetFocus
End If
End Sub
Private Sub txtMemStatus001_Change()
If txtMemStatus001.Text = "False" Then
txtMemStatus001.BackColor = vbRed
84

ElseIf txtMemStatus001.Text = "True" Then


txtMemStatus001.BackColor = vbGreen
Else
txtMemStatus001.BackColor = &H80000005
End If
End Sub
Private Sub txtStatus001_Change()
If txtStatus001.Text = "False" Then
txtStatus001.BackColor = vbRed
ElseIf txtStatus001.Text = "True" Then
txtStatus001.BackColor = vbGreen
Else
txtStatus001.BackColor = &H80000005
End If
End Sub
Private Sub ClearBookInfo()
txtBookID.Text = ""
txtMemberID.Text = ""
txtStatus001.Text = ""
txtMemStatus001.Text = ""
txtBookID.SetFocus
End Sub

85

FrmAbout
Private Sub Command1_Click()
Unload Me
End Sub

86

Module
Global UserName As String
Global myCon As New ADODB.Connection
Global reSet As New ADODB.Recordset
Global Query As String
Global Counter As Integer
Dim Confirmation As Byte

87

This is a Library Management system.This system is a unique system for managing transaction in a
college. This has been made simple by the use of MDI Form and different Menus. Tool bar has also
been designed to facilitate easy ready reckoner.Help system is also has been provided to facilitate the
user. Extra tools has been provided to easily work out the extra works like writing in the notepad and
saving and calculation s with the calculator. With some more modification this system can be adopted
for the profession use.

88

Andrew Troelsen, Visual Basic. and the >NET Plateform


Rocky, Lhotka, Professional VB.NET
Garry Cornell, Jonthan Morrison, Programming VB, A guide for Experienceed programmers
Daniel Appleman, Dan Appleman, Moving to VB: Strtegies , Concepts and Code
Mathew Reynolds , Beginning VB
Dan Fox, Building Distributed application with VB

Carston Thompson , Carl Prothman, Database Programming with VB.


Steven Roman ,Ron Petrusha, Paul Lomax, VB Language in a Nutshell
Brian Bischof, The . VB Language: A Quick Translation Guide
Keith Franklin, VB for Developers
Cameron Wakefield, Henk Evert Sonder, Wei Meng, Less, VB Programming Developers Guide

89

LIST OF WEB SITES


http://msdn.microsoft.com/vbasic
http://www.gotdotnet.com

http://www.vbwire.com
http://www.mvps.org/vbnet/
http://www.vbwm.com/
http://www.zdnet.com
http://www.codeguru.com/
http://www.vnc.co.il/ArticleVisualstudio.asp
http://www.devx.com/dotnet/
http://www.fawcette.com/dotnetmag/

90

Anda mungkin juga menyukai