Вы находитесь на странице: 1из 420

Documentation for Easy Library Management System

1. Definition
1.1 Overview of Educational Institution:

Himalaya International Model School is a secondary school situated at Eastern part of Katmandu, Nepal. It has about 1200 students studying at different grades from Nursery to 10. This institution follows the curriculum prescribed by the Government of Nepal. Since this curriculum requires vast resource, the school has a spacious and big library that contains many useful resources. It includes about 6000 books from different categories and has a single staff, the librarian: Mr. Yadhunath Acharya, to manage all these books. The students from grades one and higher are given the permission of using this library, since last two years. About 100 books are issued weekly by it and most of them are issued to the fifth grader or higher. The librarian relies on manual method for keeping the record of books and its transactions. He keeps the record of the issued books and the total books in the register provided by the school. In addition, he is planning to divide the books into Reference and Non-fiction.

1. 2 Current System and Procedures:


Mr. Yadhunath Acharya is currently using the registers for keeping records of the transaction (issue/return) made. He issues maximum three books at a time to a student. He has to check the register to know about the due books (unreturned books) and charges fine to those who havent returned books in time. Before issuing books, he checks the membership card (preview is included in Appendix I) to know if the membership of the student has expired. When a book is issued, he writes the name of the borrower from the card, name of the book, issue date and various other details in the register. If any book is returned, he mentions the return date by the side of issue date of the previous transaction. He then compares the issue date and return date to know if fine is to be paid. He calculates a fine of Rs. 2/day for 7 days and Rs. 5/day for the rest time. The preview of the registers and book card is included Appendix I.

Bishwanath Parajuli

Documentation for Easy Library Management System

1. 3 Data types used in the manual system:


Mr. Acharya has divided the book record register in 13 sub-headings. Published Year and Date of Entry are expressed in the form of Short Date. Number of pages, Volume and Cost are expressed in Integer or number. Similarly, Author, Accession Number, Title of Book and Place & Publisher are entered as String or alphabet. In the same way, he has divided the issue register in 10 sub headings. The Issue On date, Due On date and Returned On date are expressed as Short Date. Author/Publisher, Accession Number, Title of Book/Magazine and Borrowers Name are String or alphabet.

Bishwanath Parajuli

Documentation for Easy Library Management System

2. Investigation and Analysis:


2.1 Problem with current system and procedures:

Manual system always has some problem. This system has the problems as listed below: The library has no record of the total book it consists and the member linked to it. Issue process is very time consuming and chances of getting mistakes is high. Besides the same book may be issued twice by a borrower or more than three books may be issued at a time. Calculating fine is also very tedious process and can be collected by anyone. Searching the records of issue is very difficult and tedious. Searching the availability of book is difficult. Checking the validity of the card is time consuming Writing issue details makes the borrower to wait in queue As the records are kept manually, there are chances of losing the records.

Bishwanath Parajuli

Documentation for Easy Library Management System

Dataflow Diagram: Manual System


Book Details Register Book id Book title ISBN Author Publisher, e.t.c Member Details Register Member id Name Gender Grade address, e.t.c
If membership expires

Issue a book

Check membership status or any fine left to pay.

If book crosses its due date

Calculate fine Rs. 2 until 7 days and Rs. 5 for rest of the time.

The user renews membership of the member.

Prepare the book so that it can be issued again

Bishwanath Parajuli

Documentation for Easy Library Management System

2.2

Analysis:

After having an understanding of the current system, information was to be collected about the problems the user faced and the effect of the problems upon the management. A detail of the survey has been included below:

2.2.1 Requirements Analysis:


In this phase of analysis, basic requirements of the user were analyzed. Approaching to various users of different departments, their requirements were noted. Following methods were used for collecting the information: A detailed interview with Mr. Yadhunath Acharya, the librarian, about the current system, problems faced in the current system and requirements in the new system Interview with the principal Ms Jait Rai Discussion with some of the students about the current library system, possible amendments and general interests Study of the registers used in the library Research of the library systems available over the internet Questionnaires to the students The copies of the interview and the pattern for questionnaires have been included in Section (I).

Bishwanath Parajuli

Documentation for Easy Library Management System

2.3 Summary of Users Requirements:


After the analysis, the users proposed a list of requirements. The following are the major requirements of the proposed requirements: The new system should be able to carry out important library tasks as issue, renew/return and reservation in an easier and convenient way. Searching the records must be easier and less effort consuming Adding new member/books/supplier should be available along with editing them. Should be able to search the book records by shelf number The user rights should be divided based on password protection.

Bishwanath Parajuli

Documentation for Easy Library Management System

2.4 Gantt chart:


The project was very vast so a suitable plan had to be adopted. Gantt chart was considered a good approach for developing the plan. Activity Interview with librarian Distributing Questionnaires Study of current system Research of the system through various sources Collection of questionnaires Analysis of system requirements Design of new system Developing program specification Application Development Testing the application Preparing documentation Implementation of the application Cross checking of the documentation (Final Check) Current Week Bishwanath Parajuli 7 1 2 3 4 5 6 7 8
Number of Weeks

Documentation for Easy Library Management System

2.5 Feasibility Study:


2.5.1 Technical Feasibility: 2.5.1.1 Study of the System
Within the available period, there were two possible solutions as a new system. Computerized system: Computerized system will be best for this problem because the library already has a standalone computer that have been examined during the investigation and can easily run packaged software like Microsoft Office Package or the application itself. The intended benefits of computerized system over barcode system are: 1. It is economically feasible and no upgrade is required for this computer. 2. Mr. Acharya already has some knowledge on operating the basic computer activities. So extra training is not required. 3. Since about 100 books are issued in the library weekly, the work does not require very fast response. 4. The software can be finished in deliberate time. Therefore, computerized system was considered the best choice out of the three choices.

Bishwanath Parajuli

Documentation for Easy Library Management System

Computerized system with barcode: Bar-Code system is a popular solution for this type of problem. Mr. Acharya will find it convenient to make issue or renew/return through the help of this system. However, there are lots of disadvantage in using this system. Some of them are: 1. Requires faster and more efficient computers due to which the computers available will require an upgrade that is not economically feasible. 2. Operating the new system will obviously require some training and description of the computer peripherals that will be not be operationally feasible. 3. Developing such software requires much time and such problems are very difficult to deal with.

Bishwanath Parajuli

Documentation for Easy Library Management System

2.5.1.2 Study of available environments for the solution:


Many software environments could make such software. The possible softwares are listed below: C++: C++ is possibly the most powerful and popular language for creating softwares. Though it is capable of designing this program, developing the system in such environment requires much effort and cannot be completed within planned time. Visual Basic: Visual Basic (VB) is powerful window-based application development environment. It has case-insensitive interface and easy-to-remember codes. Besides the powerful database link of this environment would help the user to maintain the database more easily. The developer could complete the whole system in the scheduled period. This made VB the best solution for the problem. Oracle: Oracle is very powerful and popular database with application interface and data storage. However, oracle has a vast interface and requires powerful computers. Therefore, in spite of the features in oracle, it requires much effort and time to develop an application using it. Microsoft Office Access: Microsoft (MS) Office Access was considered the best solution because VB has easy connectivity with it. Besides, it has a powerful interface that allows the user to maintain data relationship, enforce data integrity and define the data types. MS Access also allows the use of SQL statements that promotes the security of the data. Therefore, Microsoft Access was chosen.

Bishwanath Parajuli

10

Documentation for Easy Library Management System

Crystal Report : After the application development program and the database solution, output method was needed. Despite Crystal Reports powerful interface, it was not considered as a best choice because it required large amount of disk space. Besides, the library would not need much more stylish reports as produced by it. Data Report: After Crystal Report, Data Report in VB was considered. The feature available in Data Report would allow the developer and the user to make the effective output. Besides, feature available in Data Report could make a suitable output. Therefore, Data Report was considered the best choice.

Bishwanath Parajuli

11

Documentation for Easy Library Management System

2.5.2 Economic Feasibility:


To implement the new system the institution does not have to make any major expense. The institution can avail a Pentium-3 computer for the library purpose. However, the institution needs to buy a normal printer for this application. The printer, at the current date, costs about Rs. 4000 or $ 63.6.

2.5.3 Operational Feasibility:


The new system, obviously, requires trainings. However, only librarian requires major training for operating the system and as the librarian has, a quite, knowledge of the computer system, it is possible that the training procedure will not last for more than 2-3 days. 2.5.4

Schedule Feasibility:

The Gantt chart included above was regarded as a schedule for completing the project. However, the school sought the complete software within 2 months from the date of commencement of the project. 2.5.5

Legal Feasibility:

The copyright is preserved in the name of the programmer and the solution till the date didnt clash any cyber laws stated by the country.

Bishwanath Parajuli

12

Documentation for Easy Library Management System

2.6. Requirements Specification:


2.6.1 System Requirements:

According to the analysis carried in the investigation phase and outcomes agreed, the system needed to have a complete and easy library-managing interface. The system should be able to input the data like member/book/Publisher and Author records. Additionally, it should include the feature of maintaining Supplier records. It should be able to store the records of issue, renew/return, reserve. It should also be able of calculating the fine the member needs to pay and the due days. The feature of calculating total fine by the administrator will be welcomed. The access to the program should be prevented from the unauthorized users. Besides, use of message boxes in various tasks should be friendly and well directing. 2.6.2

Hardware Requirements:

The system requires a mouse for selecting data, a keyboard for entering data. It also requires a CD-ROM drive and a general printer for printing the hard-copy output. 2.6.3

Software Requirements:

The new system requires an IBM compatible windows version 9.x or similar series of later operating systems. Besides, it requires all the modules required by VB including Microsoft Office Package installed in it.

3. System Design
Bishwanath Parajuli 13

Documentation for Easy Library Management System

3.1

Objectives of the new system:

Allow the authorized user to add new records regarding books, members, publisher, author and suppliers, and allow editing/removing them. Allow easier and convenient searching of data from various data tables. Allow the authorized user to carry out routine library tasks such as issue, renew/return and reserve. Allow only authorized user to get into the system and allow provision for a single administrator only. Allow to add new authorized users according to the rights specified. Also provide the feature of deleting the user or changing the password. Allow the administrator to control all the library tasks. Also allow provision of General User who can carry out major library tasks in absence of administrator. Prevent the user from issuing a reference book. Prevent from issuing reserved books, issuing more than three books at a time or issuing same book at a time. Allow the same provision in reserving. Prevent the member from issuing, reserving, renewing or returning the book who has fine to pay or whose membership has expired. Allow the user to cancel reservation if demanded. Prompt the authorized user to cancel the reservation, if made, while the borrower is about to issue reserved book. Cancel all the reservation that has crossed its due date at the startup of the program. Allow automatic calculation of the fine and allow printing a fine report. Only allow the administrator to collect the total fine. Prompt the authorized user to collect and clear fine (No partial payment allowed) from the borrower if any borrowed book has crossed its due date. Allow printing/viewing the details of the member, books, reservation and due books in the form of reports. Allow viewing the due books at startup, if configured.

Bishwanath Parajuli

14

Documentation for Easy Library Management System

Allow to contact the suppliers through the means of email. Allow viewing the history of issued books for further reference. Allow the authorized user to keep the records of book requested in the library. Allow the authorized user to view issued books and membership status of the borrower.

Bishwanath Parajuli

15

Documentation for Easy Library Management System

3.2

Design Specification:

3.2.1 Data Structure Design


The database uses many tables/queries to retrieve required information. The design of the tables/queries used in database along with their relationship is given below. List of Tables Name of Table Description

tblbookdetails:
Field Book_Code (Primary Key) Title Edition Type_of_Book Number_of_Copies Published_Year ISBN Price Shelf_Number Data Type Long Integer Text (Max Size=80) Text (Max Size=25) Text (Max Size =15) Long Integer Long Integer Text (Max Size =13) Long Integer Long Integer Description A unique code assigned to each book (auto-number). Stores the title of the book Stores the edition of book Stores the book type Stores the total number of the book in library Stores the year when the book was published Stores the ISBN of the book Stores the total price of the book Stores, to which shelf the book belongs Example 201 HTML Practice 3rd Reference 3 2004 13x744744480 45 2

Bishwanath Parajuli

16

Documentation for Easy Library Management System

tblmember:
Field ID (Primary Key) First_Name Middle_Name Sur_Name Date_of_Birth Education_Level Contact Gender Activation_Date Expiry_Date path Data Type Long Integer Text (Max Size=30) Text (Max Size=30) Text (Max Size=30) Date/Time Text (Max Size=20) Text (Max Size=30) Text (Max Size=6) Date/Time Date/Time Text (Max Size=30) Description A unique ID of each member (auto-number) Stores the initial part of the borrowers Name. Stores the middles of the borrowers name Stores the sur name of the borrowers name Stores the birth date of the borrower Stores the grade or category of the borrower Stores the contact number/address of borrower Stores the information of gender of borrower Stores the membership activation date of the borrower Stores the membership expiry date Stores the path for picture of the borrower Example 401 Kumar Prasad Lama 5/6/2007 10 4488555 Male 5/6/2006 5/6/2008 ama_6.jpg

tblusers:
Field User_Name (Primary Key) User_Type Password Data Type Text (Max Size=8) Text (Max Size=30) Text (Max Size=8 Description Stores the username of a user Stores the user type Stores password for the user Example Lamia General User qwerty

Bishwanath Parajuli

17

Documentation for Easy Library Management System

tblauthor:
Field Author_ID (Primary Key) Author_Name Contact Country Book_ID Data Type Long Integer Text (Max Size=60) Text (Max Size=100) Text (Max Size=25) Long Integer Description Stores the unique ID for each author(auto-code) Stores the name of author Stores the contact number/ web-address of the author Stores the name of the country the author belongs Stores the book code of the authors book Example 201 Samrat Upadhaya 4488888 Nepal 101

tblpublisher:
Field Publisher _ID (Primary Key) Publisher_Name Contact Book_ID Data Type Long Integer Text (Max Size=60) Text (Max Size=100) Long Integer Description Stores the unique ID for each publisher(auto-code) Stores the name of publishers title Stores the contact number/web-address of the publisher Stores the book code of the book published by it Example 501 Ekta Publication www.ekta.com 101

tblreserve:
Field Reservation_ID (Primary Key) Book_Code Borrower_ID Reservation_Date
Date_Cancel_Reserve

Data Type Long_Integer Long_Integer Long_Integer Date/Time Date/Time

Description Stores a unique ID for each reservation(auto-code) Stores the book code of the reserved book Stores the ID of the borrower Stores the date when the reservation was made Stores the date when the reservation cancels

Example 601 101 401 4/6/2007 4/16/2007

Bishwanath Parajuli

18

Documentation for Easy Library Management System

tblissue:
Field Name Issue_ID (Primary Key) BookCode Borrowers_ID Date_of_Issue Returning_Date Student_Memo Status Book_Type Data Type Long Integer Long Integer Long Integer Date/Time Date/Time Text (Max Size=30) Text (Max Size=3) Text (Max Size=12) Description Stores a unique number (auto-code) for every issue that is made Stores the code assigned for each book(Mandatory) Stores the ID assigned to member making the issue (Mandatory) Stores the issue date(System Date) Stores the returning date of the issued book Stores about the borrowing activity of the student Stores the whether the book has crossed its due date or not. Stores the type of book Example 101 201 401 4/3/2007 4/10/2007 Returns Late Yes Non-fiction

tblfine:
Field Name Fine_ID (Primary Key) Book_Code Member_ID Overdays Fine(Rs) Data Type Long Integer Long Integer Long Integer Text (Max Size=15) Long Integer Description Stores a unique ID (auto-code) for each fine record Stores the book code of the borrowed book that has crossed its due date Stores the member ID of the member who needs to pay fine Stores the number of days after the due date, until the book had been returned Stores the total fine amount for the member Example 111 201 401 5 10

tblorderbooklist:
Field Name Book_Title (Primary Key) Data Type Text (Max Size=80) Description Stores the title of the requested book Example War and Peace

Bishwanath Parajuli

19

Documentation for Easy Library Management System

tblsupplier
Field Name Supplier_ID (Primary Key) Supplier Address Contact Data Type Long Integer Description Stores a Unique ID (auto-code) for every supplier Example 444 Ekta Publication Kapan www.ekta.com

Text Stores the name of the supplier (Max Size=80) Text Stores the address of the supplier (Max Size=80) Text Stores contact number/web-address of the supplier (Max Size=40)

tblsettings:
Field Name Quickbook Quickmem Compact Inform Backup Data Type Text (Max Size=5) Text (Max Size=5) Text (Max Size=5) Text (Max Size=5) Text (Max Size=5) Description Stores data, whether or not to show frmreminders Stores data, whether or not to show frmovrmem Stores data, whether or not to compact the database at the termination of the application Stores data, whether or not to tell the user about the total fine collected when the application loads Stores data, whether or not to backup the database at the termination of the application Example Yes No Yes Yes No

tblhistory:
Field Name History_Code (Primary Key) Book_ID Member_ID Issue_Date Returned_Date Comments Data Type Long Integer Long Integer Long Integer Date/Time Date/Time Text (Max Size=5) Description Stores a unique code for the storing an issue done in the past Stores the book code for the book issued in the past Stores the member id for the member that issued book(s) in the past Stores the date when issue was made Stores the date when the book was returned Stores the comments on the member Example 801 201 401 2/3/2007 2/10/2007 No Comments

Bishwanath Parajuli

20

Documentation for Easy Library Management System

List of Queries Query Description

Bishwanath Parajuli

21

Documentation for Easy Library Management System

Query

SQL Code
SELECT tblissue.BookCode, tblbookdetails.Title, tblissue.[Borrower's_ID], ([First_Name] & " " & [Middle_Name] & " " & [Sur_Name]) AS Name, tblissue.Date_of_Issue, tblissue.Returning_Date

qryissue

FROM tblmember INNER JOIN (tblbookdetails INNER JOIN tblissue ON tblbookdetails.Book_Code = tblissue.BookCode) ON tblmember.ID = tblissue. [Borrower's_ID]; SELECT tblbookdetails.Book_Code, tblbookdetails.Title, tblbookdetails.Type_of_Book, tblmember.ID, ([First_Name] & " " & [Middle_Name] & " " & [Sur_Name]) AS Name, tblmember.Contact, tblfine.Overdays, tblfine.[Fine(Rs)] FROM tblmember INNER JOIN (tblbookdetails INNER JOIN tblfine ON tblbookdetails.Book_Code=tblfine.Book_Code) ON tblmember.ID=tblfine.Member_ID; SELECT tblreserve.Book_Code, tblbookdetails.Title, tblreserve.Borrower_ID, ([First_Name] & " " & [Middle_Name] & " " & [Sur_Name]) AS Name, tblreserve.Reservation_Date, tblreserve.Date_Cancel_Reserve

qryfine

qryreserve

FROM tblmember INNER JOIN (tblbookdetails INNER JOIN tblreserve ON tblbookdetails.Book_Code=tblreserve.Book_Code) ON tblmember.ID=tblreserve.Borrower_ID; SELECT tblissue.BookCode, tblbookdetails.Title, tblbookdetails.Type_of_Book, tblissue.[Borrower's_ID], ([First_Name] & " " & [Middle_Name] & " " & [Sur_Name]) AS Name, tblmember.Expiry_Date, tblissue.Date_of_Issue, tblissue.Returning_Date, tblissue.Status

qrydue

FROM tblmember INNER JOIN (tblbookdetails INNER JOIN tblissue ON tblbookdetails.Book_Code=tblissue.BookCode) ON tblmember.ID=tblissue. [Borrower's_ID] WHERE (((tblissue.Status) Like 'No'));

Query

SQL Code
SELECT tblhistory.History_Code, tblhistory.Book_ID, tblbookdetails.Title, tblhistory.Member_ID, ([First_Name] & " " & [Middle_Name] & " " & [Sur_Name]) AS Name, tblhistory.Issue_Date, tblhistory.Returned_Date, tblhistory.Comments FROM tblmember INNER JOIN (tblbookdetails INNER JOIN tblhistory ON tblbookdetails.Book_Code=tblhistory.Book_ID) ON tblmember.ID=tblhistory.Member_ID; SELECT tblbookdetails.Book_Code, tblbookdetails.Title, tblbookdetails.Edition, tblbookdetails.Number_of_Copies, tblbookdetails.Published_Year, tblbookdetails.Price, tblbookdetails.Shelf_Number, tblpublisher.Publisher_Name, tblauthor.Author_Name

qryhistory

qrybookdetails

Bishwanath Parajuli FROM (tblbookdetails INNER JOIN tblauthor ON


tblbookdetails.Book_Code=tblauthor.Book_ID) INNER JOIN tblpublisher ON tblbookdetails.Book_Code=tblpublisher.Book_ID;

22

Documentation for Easy Library Management System

Bishwanath Parajuli

23

Documentation for Easy Library Management System

3.2.2 Entity Relationship Diagram:


Authors can write can be issued Issues can issue Members Books can be reserved Reserves can reserve can publish Publishers

Requested Books Note: Every box represents a table.

Users

History

Settings

Fine

Authors and Books have many to one relationship because many authors can write a book. Publishers and Books have one to one relationship because only one publisher publishes a book. Book and Issues have one to many relationships because a book can be issued many times. Book and Reserves have one to many relationships because a book can be reserved many times. Member and Issues have one to many relationships because a member can issue many books. Member and Reserves have one to many relationships because a member can reserve many books.

The box without any lines shows, it does not have any relationship.

Bishwanath Parajuli

24

Documentation for Easy Library Management System

3.3 Algorithm, Pseudocode and Flowcharts:


3.3.1 Algorithms :

Open database and data tables referring the connection link Avialable Options Add New Records Save Records Check Validation Sorting Records Editing Records Deleting Records Searching Records Exporting Data Populating Records Printing Records Select case Available Options Case Add New Record Step 1: Clear text boxes Step 2: Move record pointer to the end of file Step 3: Copy record number Step 4: Generate code number by adding 1 to the record number Step 5: Reserve a space in the database for saving an record Case Save Record Step 1: Read data in the text boxes Step 2: Check the data validation Step 3: If invalid data is found, then display error message Step 4: Else, set the value/data to the specified fields in the table Step 5: Save the data. Step 6: Display message as directed. Case Check Validation

Bishwanath Parajuli

25

Documentation for Easy Library Management System

Step 1: Check if the field is empty Step 2: If not, compare the data with the rule specified Step 3: If rule and data matches continue with ongoing task Step 4: Else, display an error message and terminate the process. Case Sorting Records Step 1: Step 2: Compare the data with one another. Keep the data in correct place as requirements

Case Editing Records Step 1: Step 2: Step 3: Step 4: Step 5: Step 6: Step 7: Move to the first record Check until the end of the file. Compare key field of the record to be edited with that on the database. If matched, set the new data to the specified fields. Update the new data/record. If not, move to next record and continue matching. Display message as directed.

Case Deleting Records Step 1: Move to the first record Step 2: Check until the end of the file. Step 3: Compare key field of record to be deleted with that on the database. Step 4: If found, delete the records from the database. Step 5: If not, move to next record. Step 6: Display message as directed.

Case Searching Records Bishwanath Parajuli 26

Documentation for Easy Library Management System

Step 1: Move to the first record Step 2: Check until the end of the file. Step 3: Compare the search code in the specified table. Step 4: If found, display the records in specified fields of the forms. Step 5: If not, move to next record. Step 6: Display message as directed. Case Exporting Data Step 1: Declare, for the ongoing task, the required variables and controls. Step 2: Specify the form fields for the data to be exported. Step 3: Open the requested window or do the requested task. Case Populating Records Step 1: Move to the first record. Step 2: Check until the end of the file. Step 3: Populate the data from the specified fields. Step 4: Move to next data for populating Step 5: Continue until all the records are populated. Case Printing Records Step 1: Read the data to be printed Step 2: Open requested/concerned application or form to print the data through it. Step 3: Print the report

Bishwanath Parajuli

27

Documentation for Easy Library Management System

3.3.2

Pseudocode :

Calculating Fine: Begin Declare variables x = returning date y = returned date If y-x < 1 then duedays = 0 day Elseif y-x = 1 then duedays = 1 day Elseif y-x >1 then duedays = y-x days End if If y-x <= 0 then fine = 0 Elseif y-x < 7 then fine = (y - x) * 2 Elseif y-x >= 7 fine = (7 * 2 + (y - x - 7) * 5) End if

Bishwanath Parajuli

28

Documentation for Easy Library Management System

3.3.3

Flowcharts :

1. For Adding new records: Start Clear textboxes Move record pointer to last record Copy pointer value Add 1 to the pointer value Reserve a space in database with keyfield, the value of pointer End

Bishwanath Parajuli

29

Documentation for Easy Library Management System

2. For Saving records: Start Read data into textboxes Check Validation Set the datas in the specified fields of the table. Save the record. Display message. End

Bishwanath Parajuli

30

Documentation for Easy Library Management System

3. For Checking Validation: Start

Is the field empty?


No

Yes

Display error message.

Invalid data found?


No

Yes

Display error message.

Continue with rest of operation End

Bishwanath Parajuli

31

Documentation for Easy Library Management System

4.

For sorting data: Start Compare the list of data with one another. Keep the data in correct position as directed. End

Bishwanath Parajuli

32

Documentation for Easy Library Management System

5. For editing records: Start Move to first record.

Is it the end of the file?


No

Yes

Display messag e

Does the key field match?


Yes

No

Move to next record.

Set the new datas in the specified fields. Update the record. Display message. End

Bishwanath Parajuli

33

Documentation for Easy Library Management System

6. For deleting records: Start Move first record.

Is it the end of the file?


No

Yes

Display messag e

Does the key field match?


Yes

No

Move to next record.

Delete the data Display message. End

Bishwanath Parajuli

34

Documentation for Easy Library Management System

7. For searching data: Start Move first record.

Is it the end of the file?


No

Yes

Display messag e

Does the key field match?


Yes

No

Move to next record.

Display the searched data. Display message. End

Bishwanath Parajuli

35

Documentation for Easy Library Management System

8. For exporting the data:

Start Declare the variables and controls. Copy the required data from the form to the form fields. Open the required application window or do the requested task. End

Bishwanath Parajuli

36

Documentation for Easy Library Management System

9. For populating data in list-box or combo-box:

Start Move first record.

Is it the end of the file?

Yes

Display messag e

Add data into the listbox or combo-box Move to next record. End

Bishwanath Parajuli

37

Documentation for Easy Library Management System

10.

For printing records:

Start Read the data to be printed Open the application or form to print the data Print the report End

Bishwanath Parajuli

38

Documentation for Easy Library Management System

11.

For calculating fine: Start Decalre variables Assign the value of dater.

Convert dater and system date into integer. Calculate difference between dater and system date. Case 1 Case 2

Difference? <7
<=0 Label = difference*2

Difference? >1 1
Label = 1 Day Label = difference Days

<1

Label = 0 Day

>7
Label = Blank

Label = (7 * 2 + (difference - 7) * 5)

End

Bishwanath Parajuli

39

Documentation for Easy Library Management System

3.4 Input Design:


Member Details Form: Member ID Member Name Date of Birth _____________ _____________ _____________ Members Photo

Category/Grade _____________ Number/Mail Address _____________ Gender Male Female _____________ _____________ Renew Membership Option button

Membership Acquired Date Membership Expiry Date

Add

Save

Delete

Modify

Cancel

Erase

First

Previous

Next

Last

Print a Library card

Command buttons

Bishwanath Parajuli

40

Documentation for Easy Library Management System

Book Details Form:

Code Title Types of Book Edition Copies ISBN Volume Price Shelf Number

_____________ _____________ _____________ _____________ _____________ _____________ _____________ _____________ _____________

Change Code

Add Modify

Save Cancel

Delete Erase

First

Previous

Next

Last

Bishwanath Parajuli

41

Documentation for Easy Library Management System

Publisher and Author Details Form: Author Tabs:

Book Code

Combo box

Title of Book
Author ID Author Name Author Contact Country

_____________ _____________ _____________ _____________ _____________

New Author New Author Save Author Save Author Cancel Saving Cancel Saving Delete Author Delete Author Modify Modify

Bishwanath Parajuli

42

Documentation for Easy Library Management System

Publisher Tabs:

Book Code New Publisher New Publisher

Title of Book
Publisher ID Publisher Name Publisher Contact

_____________ _____________ _____________ _____________

Save Publisher Save Publisher Cancel Saving Cancel Saving Delete Publisher Delete Publisher Modify Modify

Bishwanath Parajuli

43

Documentation for Easy Library Management System

Supplier Details:

Supplier ID

Supplier Name Address

_____________ _____________

Save Supplier Save Supplier Delete Delete Modify Modify Refresh Refresh Mails Mails

Contact View Details

_____________

Tabular View

Check box

Bishwanath Parajuli

44

Documentation for Easy Library Management System

Security Form Add new user Tabs


User Name User Type Password Confirm Password

_____________ _____________ _____________ _____________


Add New User

Clear

Bishwanath Parajuli

45

Documentation for Easy Library Management System

Change Password Tabs


User Name Old Password New Password Confirm New Password

________________ ________________ ________________ ________________


Add New User

Clear

Bishwanath Parajuli

46

Documentation for Easy Library Management System

Delete user Tabs:

User Name Password

______________ ______________
Delete User

Bishwanath Parajuli

47

Documentation for Easy Library Management System

3.5 Process Design:


Issue Form: Title of Book Issue Code
Type of Book Issue Date Clear Borrower's ID Book Code Issue Returning Date

Name of Borrower Photo

Comments

Bishwanath Parajuli

48

Documentation for Easy Library Management System

Reservation Form:

Book Code

Borrower's ID

Title of Book
Reservation Date

Name of Borrower
Reservation Cancels On Reserve Cancel Reservation

View Details
View Books View Reservation

Tabular View

Bishwanath Parajuli

49

Documentation for Easy Library Management System

Renew/Return Form: Menu Bar


Borrower's ID Renew Book Code Return

View Details Title of Book Issue Date Return Date

Due Days Total Fine


Collect Fine

Borrower Name Contact Membership Expiry List View Status Bar Photo

Bishwanath Parajuli

50

Documentation for Easy Library Management System

Search Form: Search Criteria Issues Authors Members Publishers Books Reserves

Search category (appears according to search criteria) Search Text _____________ Tabular View
Search Sort

Sort Form:

Sort Fields

Ascending Descendin g
Unload

Filter Text
Filter

___________

Bishwanath Parajuli

51

Documentation for Easy Library Management System

Fine Form:

Total Fine
Calculate fine paid by a member

Collect Fine

View Details Tabular View

Bishwanath Parajuli

52

Documentation for Easy Library Management System

View Membership Status Form:

The membership that expires on Date Picker

Tabular View View Issues Form:


The books that cross its due date after Days

Tabular View

Bishwanath Parajuli

53

Documentation for Easy Library Management System

History Form: Book Code Title of Book


History Code

Student ID Name of Student Issue Date List box

View Details

Comments Tabular View

Request Form:

Title of Book

__________

Name of Books

Queue It! Print

Double Click to Remove

Bishwanath Parajuli

54

Documentation for Easy Library Management System

Overview of Library: Total Memeber Total Books Total Issues Librays Net Value Preference Form: Preference Form: As a whole Categorywis e
OK

Compact and Repair database at the termination. Create Backup at the termination of the program. Create Backup at the termination of the program. Create Backup at the termination of the program. Create Backup at the termination of the program. Cancel Cancel Apply Apply

Login Form: Username Password


Cancel

__________ __________
OK

Overview Form: Tabular view of issued books that have crossed their due date

Bishwanath Parajuli

55

Documentation for Easy Library Management System

3.6 Output Design:


Reports are considered the main output method of the new system. Information about the summary of major library activities can be inferred from the reports. Most of the reports of the new system were created using Microsoft Access query designs SQL view. The primary output layouts along with the design view of query of the reports are shown below: Members Report:

HIMALAYA INTERNATIONAL MODEL SCHOOL


Narayantar, Jorpati-2 [Date] List of Members
ID First Name Middles Sur Name DOB Grade Contact Activation Date Expiry Date

Books Report:

HIMALAYA INTERNATIONAL MODEL SCHOOL


Narayantar, Jorpati-2 [Date] List of Books
ID Title Edition Copies Year Price(Rs) Shelf Publisher Name Author Name

Total number of Books: -

Total Worth of Library: -

Bishwanath Parajuli

56

Documentation for Easy Library Management System

Fine Reports:

HIMALAYA INTERNATIONAL MODEL SCHOOL


Narayantar, Jorpati-2 [Date] Fine Details
Code Title Member ID Name Overdays Fine(Rs)

Total Fine: - Rs.

Reservation Reports:

HIMALAYA INTERNATIONAL MODEL SCHOOL


Narayantar, Jorpati-2 [Date]
Code Title Member ID Name Reserved Date Cancellation Date

Due Reports:

HIMALAYA INTERNATIONAL MODEL SCHOOL


Narayantar, Jorpati-2 [Date]
Code Title Member ID Name Membership Expiry Issue Date Return Date

Bishwanath Parajuli

57

Documentation for Easy Library Management System

Bishwanath Parajuli

58

Documentation for Easy Library Management System

3.7

Menu Design
Management Menu:
Book Details Member Details
Publisher and Author Details

File Menu:
Issue
Renew/Return

Edit Menu:
Search Fine History Request New Book Overview General Overview

Settings Menu:
Database Utilities Security Preference

Report Menu:
Memebers Books Fine Reservation Due

Help Menu:
About Contents

Reservation Exit

Supplier Details

Issued Books Membership


Backup Restore Compact and Repair

Bishwanath Parajuli

59

Documentation for Easy Library Management System

4. Intended Benefits:
The proposed benefits from the implementation of new computerized system in library management are: 1. The routine task of the library will be easier and efficient. 2. Searching the records will be very quick and easy. The books can be searched based on the shelf number too. 3. Maintaining records of supplier will be very quick. 4. Reports can be generated and printed to manage the daily transaction and status of the library. 5. The user will be informed about the ongoing activities through the help of suitable message boxes, which will possibly reduce the frequency of errors. 6. History of issued books can be viewed easily. 7. The due books can be seen at the startup of the program, if configured. 8. Additional feature is provided in the system as mentioned in the system. 9. The system will be password protected. The access right is divided into three users Administrator or Head Librarian, General User and Visitor. The visitor is allowed to search records and to view data only. The General User can carry out major library tasks but cannot modify records.

Bishwanath Parajuli

60

Documentation for Easy Library Management System

5. Limits of the Scope of Solution:


No solution is perfect at all. Even a computerized solution has limits in the scope although it is far better choice than manual system. Since this system has been developed to manage small transactions, the radical increase in the transaction will be instability of database. For example, the maximum numeric value for the books code is 4 bytes. However, if the maximum numeric value is exceeded, certainly a database will be instable. Beside the sizing limits, this application may have some limits in feature. For example, if the records are filtered many times the program may display an error message showing that the program could carry out filter process. Besides, extra feature could also be included into this system such as, ability of printing notice, keeping records of book that needs repair, etc.

Bishwanath Parajuli

61

Documentation for Easy Library Management System

Database files Size estimation:


tblmember: ID = 4 bytes, First_Name = 30 bytes, Middle_Name = 30 bytes, Sur_Name = 30 bytes, Date_of_Birth = 8 bytes, Education_Level = 20 bytes, Contact = 30 bytes, Gender = 6 bytes, Activation_Date = 8 bytes, Expiry_Date = 8 bytes, path = 30 bytes
Total size = 204 bytes; Expected Members = 900; Total size of the table = 183.6 KB

tblbookdetails: Book_Code = 4 bytes, Title = 80 bytes, Edition = 25 bytes, Type_of_Book = 15 bytes, Number_of_Copies: 4 bytes, Published_Year = 4 bytes, ISBN = 13 bytes, = 4 bytes
Total size = 161 bytes; Expected Books = 6000; Total size of the table = 966 KB tblusers:

Price = 4 bytes, Shelf_Number

User_Name: 8 bytes, User_Type = 30 bytes, Password = 8 bytes.


Total size = 46 bytes; Expected Users = 4; Total Size of the table = 0.2 KB tblauthor:

Author_ID: 4 bytes, Author_Name = 60 bytes, contact = 100 bytes, country = 25 bytes, Book_ID = 4 bytes
Total Size = 193 bytes; Expected Authors = 1500; Total size of table = 289.5 KB

Bishwanath Parajuli

62

Documentation for Easy Library Management System

tblpublisher:

Publisher _ID = 4 bytes, Publisher_Name = 60 bytes, Contact = 100 bytes, Book_ID = 4 bytes

Total Size = 168 bytes; Expected publishers = 1000; Total size of table = 168 KB tblreserve:

Reservation_ID = 4 bytes, Book_Code = 4 bytes, Borrower_ID = 4 bytes, Reservation_Date = 8 bytes, Date_Cancel_Reserve = 8 bytes
Total size = 28 bytes; Expected Reservation per day = 5; Total increment in the size of the table = 0.14 KB per day or 4.2 KB per month

tblissue: Issue_ID = 4 bytes, BookCode = 4 bytes, Borrowers_ID = 4 bytes, Date_of_Issue = 8 bytes, Returning_Date = 8 bytes, Student_Memo = 30 bytes, Status = 3 bytes, Book_Type = 12 bytes

Total size = 73 bytes; Expected increment in size of table = 1.09 KB per day or 32.7 KB per month tblfine:

Fine_ID = 4 bytes, Book_Code = 4 bytes, Member_ID = 4 bytes, Overdays = 15 bytes, Fine (Rs) = 4 bytes
Total size = 31 bytes; Expected Records = 15, Total size of table = 0.45 KB per month

Bishwanath Parajuli

63

Documentation for Easy Library Management System

tblorderbooklist: Book_Title = 80 bytes


Expected books to be requested = 20 per month; Total size of table = 1.5 KB per month

tblsupplier: Supplier_ID = 4 bytes, Supplier = 80 bytes, Address = 80 bytes, Contact = 40 bytes


Total size = 204 bytes; Expected suppliers = 20; Total size of table = 4 KB

tblsettings: Quickbook = 5 bytes, Quickmem = 5 bytes, Compact = 5 bytes, Inform = 5 bytes, Backup = 5 bytes

Total size of table = 25 bytes = 0.02 KB

tblhistory: History_Code = 4 bytes, Book_ID = 4 bytes, Member_ID = 4 bytes, bytes, Returned_Date = 8 bytes, Comments = 30 bytes
Total size = 58 bytes, Expected returns = 15, Total increment in size of table = 0.87 KB per day or 26.1 KB per month

Issue_Date = 8

... Total estimated size of table = 1.64 MB


Bishwanath Parajuli 64

Documentation for Easy Library Management System

6. Development
6.1 Database Development
The database for this software was developed using Microsoft Office Access 2003. The preview of back-end is shown below:

Tables Design:

Bishwanath Parajuli

65

Documentation for Easy Library Management System

Bishwanath Parajuli

66

Documentation for Easy Library Management System

Bishwanath Parajuli

67

Documentation for Easy Library Management System

Bishwanath Parajuli

68

Documentation for Easy Library Management System

Bishwanath Parajuli

69

Documentation for Easy Library Management System

Bishwanath Parajuli

70

Documentation for Easy Library Management System

Bishwanath Parajuli

71

Documentation for Easy Library Management System

Bishwanath Parajuli

72

Documentation for Easy Library Management System

Bishwanath Parajuli

73

Documentation for Easy Library Management System

Bishwanath Parajuli

74

Documentation for Easy Library Management System

Bishwanath Parajuli

75

Documentation for Easy Library Management System

Bishwanath Parajuli

76

Documentation for Easy Library Management System

Query Design:
Queries are the fundamental data source of the new system. Many forms and reports depend on queries. The design of the queries was done in SQL view so the preview of every query is not necessary. However, the SQL codes are included in technical documentation and a preview of SQL code is given below along with query design:

Bishwanath Parajuli

77

Documentation for Easy Library Management System

6.2 Application Development:


This application was developed using Microsoft Visual Basic 6.0. It is 32 bit windows based Graphical Rapid Application Development (RAD) program. The preview of the systems form designs including the toolbox used, have been included below:

6.2.1

Form Design:
Toolbox:

Main Window:

Purpose: - This window provides link with all the forms plus the database utilities. Table used tblmember, tblissue, tblorderbooklist, tblsettings, tblreserve Member Details:

Bishwanath Parajuli

78

Documentation for Easy Library Management System

Purpose: - This window allows managing the member records. Table used tblmember

Bishwanath Parajuli

79

Documentation for Easy Library Management System

Fine Form:

Purpose: - This window allows calculating total fine and fine collected from a member Table/Query used tblfine/qryfinerecset

Bishwanath Parajuli

80

Documentation for Easy Library Management System

Book Details Form:

Purpose: - This window allows managing book records. Table used tblbookdetails

Bishwanath Parajuli

81

Documentation for Easy Library Management System

Login Form:

Purpose: - It allows entering username and password to authenticate access. Table used tblusers, tblsettings Sort Form:

Purpose: - This window allows sorting and filtering data field.

Bishwanath Parajuli

82

Documentation for Easy Library Management System

Issue Overview Form:

Purpose: - It allows viewing issued books and books that will cross or have crossed its due date. Query used qryissuerecset Linking Form:

Purpose: - It allows selecting the option: either to renew or to return.

Bishwanath Parajuli

83

Documentation for Easy Library Management System

Security Form:

Purpose: - It allows adding new user, modifying, and deleting the user. Table used tblusers General Overview Form:

Purpose: - It allows at-a-glance status of the library. Table used tblbookdetails, tblissue, tblmember

Bishwanath Parajuli

84

Documentation for Easy Library Management System

About Form:

Purpose: - It shows brief information on the software. Preference Form:

Purpose: - It allows the user to modify the application according to the taste of user. Table used tblsettings

Bishwanath Parajuli

85

Documentation for Easy Library Management System

Publisher and Author Details Form:

Purpose: - It allows managing the records of the publishers and the authors. Table used tblpublisher, tblauthor, tblbookdetails

Bishwanath Parajuli

86

Documentation for Easy Library Management System

Issue Form:

Purpose: - It allows maintaining detail record about issues. Table used tblissue, tblreserve, tblmember, tblbookdetails

Bishwanath Parajuli

87

Documentation for Easy Library Management System

Membership Overview Form:

Purpose: - It allows monitoring the expired memberships. Query used qryissuerecset

Bishwanath Parajuli

88

Documentation for Easy Library Management System

Reminder Form:

Purpose: - It allows viewing the books that have crossed due date. Query used qryissuerecset

Bishwanath Parajuli

89

Documentation for Easy Library Management System

Search Form:

Purpose: - It allows searching the record from the database. Table/Query used qryissue, qryreserve, tblmember, tblbookdetails, tblauthor, tblpublisher

Bishwanath Parajuli

90

Documentation for Easy Library Management System

Supplier Form:

Purpose: - It allows overseeing the records of books supplier Table used tblsupplier

Bishwanath Parajuli

91

Documentation for Easy Library Management System

Renew/Return Form:

Purpose: - It allows managing records related to issues i.e. renew or return. Table used tblissue, tblreserve, tblmember, tblbookdetails, tblhistory, tblfine

Bishwanath Parajuli

92

Documentation for Easy Library Management System

Reservation Form:

Purpose: - It allows maintating reservation records. Table used tblissue, tblreserve, tblmember, tblbookdetails

Bishwanath Parajuli

93

Documentation for Easy Library Management System

Book Request Form:

Purpose: - It allows maintating records of the book requested in the library. Table used tblorderbooklist

Bishwanath Parajuli

94

Documentation for Easy Library Management System

History Form:

Purpose: - It allows viewing the records of the books issued previously. Query used qryhistory

Bishwanath Parajuli

95

Documentation for Easy Library Management System

E-mail Form:

Purpose: - It allows sending emails.

Bishwanath Parajuli

96

Documentation for Easy Library Management System

6.2.2 Development of Reports:


The reports were developed using Data Report. The formatting of the data has been done to give the pleasant look to the reports. The screen shots of some of the reports are given below: 6.2.2.1 Design View:

Bishwanath Parajuli

97

Documentation for Easy Library Management System

6.2.2.2

Finished View:

Bishwanath Parajuli

98

Documentation for Easy Library Management System

6.2.3 Help System:

The help system was produced through Microsoft Help Workshop provided in Microsoft Visual Studio 6.0.

Bishwanath Parajuli

99

Documentation for Easy Library Management System

6.2.4 Data Structure:


Tree structure of whole system:
System Login

Input

Processing

Output Reports

Reservation

Return

Renew

Issues

Search

Book

Member

Publisher & Author

Supplier

Book Request

Fine

Bishwanath Parajuli

100

Documentation for Easy Library Management System

7. Testing
Result of testing of application is shown below. The evidence is included in Appendix I I.

Application Startup:
Tests Database is modified or removed from the path where application is stored. Unknown database is placed in the application path with the name Library Management System.mdb Database is opened exclusively when the application is run. Results Displays an error message showing that database was not found. Display an error message showing that tblusers was not found. Terminate the program. Display error message showing file already in use. Evidence 1 2 3

Login Dialog Box:


Tests Login with username Rajeevh and password scythe instead of username Rajeev and password scythe. Login with username Rajeev and password scythr instead of username Rajeev and password scythe. Login with username Rajeev and password scythe. Login with username bishwa and password parajuli. Login by pressing [Enter] key Results Display invalid username message. Evidence 4

Display invalid password message. Unload the login dialog and open Splash screen but disable Management and Fine menu. Unload the login dialog, open Splash screen and enable all the menus. Unload the login dialog, open Splash screen but enable specified menus only.

6.1 6.2 6.3

Bishwanath Parajuli

101

Documentation for Easy Library Management System

Issue Form:
Tests Press Update without selecting book code or/and member ID. Try to issue reference book 102. Try to issue a book whose all copies are issued already. Try to issue more than 3 books for a member with ID 202. Try to issue book a book with code 105 by a borrower with ID 206, twice. Try to issue a reserved book, 106. Try to issue a book by a member who has to pay fine. Try to issue a book by a member whose membership has expired. Try to issue a book 105 by a borrower 203. Try to issue a book 106 that had been reserved by borrower 206. Results Display, enter the required fields, message. Display error message. Display, no more books, error message Display, already issued 3 books, message and terminate issue. Display, already issued the book, message. Terminate issue Display, already reserved, message Prompt the user to collect fine. Deny to issue if selected No. Prompt the user to renew membership. Make the issue and save it in table tblissue. Prompt the user whether to issue the reserved book. Evidence 7 8 9 10 11 12 13 & 14 15 & 16 17

Renew/Return Form:
Tests Try to renew/return book(s) for a member who has fine to pay. Try to renew/return book(s) for a member whose membership has expired. Renew a book with code 103. Try renewing a book that has been reserved Returns a book successfully Results Prompt the user to charge fine to a borrower who has fine to pay. If denied cancel renew/return process and display error message Prompt the user to renew the membership. If denied cancel renew/return process and display error message Increase the returning date 10/23/2007 to 10/30/2007. Display error message, book is reserved. Ask if the book is received and display, return completed, message if received. Evidence 18 and 19

20 and 21 22 23 and 24

Bishwanath Parajuli

102

Documentation for Easy Library Management System

Reservation Form:
Tests Try to reserve a book that has already been issued by the borrower. Try to reserve a book by a borrower that has fine to pay. Try to reserve a book by a borrower whose membership has expired. A member 206 tries to reserve a book 105 twice. A member tries to reserve more than 3 books at a time. A member tries to reserve a reference book 102. A book is reserved successfully. A reservation is cancelled. Results Display message, book already issued. Prompt the user to collect fine. If denied terminate reservation. Prompt the user to renew membership. If denied terminate renew/return task. Display message, already reserved the book. Display message, already reserved three books. Display message, cannot reserve reference book. Display, reservation saved, message. Prompt user and cancel reservation. Evidence 25 26 & 27 28 and 29 30 31 32 33 34 and 35

Bishwanath Parajuli

103

Documentation for Easy Library Management System

Book Details Form:


Tests Try to save record without filling any/some/a field(s). Try to add a new book, 101, a book code that already exists. Try to delete/modify issued/reserved book. Delete the book successfully. Modify the record successfully. Modifying the book code. Try changing the book code to existing book code. Add new book successfully and save it. Try to search the data using search icon. Try to search the data that doesnt exist. Click on Tabular View tab. Click on grid to edit the data. Results Evidence Display, field(s) left, message and set 36 focus to unattended field. Display book already in library, 37 message and the details of book. Display, record in another table, 38 message. Display an input box to enter title or 39.1 ,39.2 and code of book and delete if the user 40 prompts to do so. Prompt the user whether or not to modify the record and change the 41, 42 and 43 record if directed. Prompt the user to change the book 44 and 45 code and change it. Display error message. 46 Display an auto book code and save the data after filling the required fields. Display the record in relevant fields. Display record not found. Display the record in grids. The selection is transmitted to form view that helps to modify the data. 47 48 -

Bishwanath Parajuli

104

Documentation for Easy Library Management System

Borrower Details Form:


Tests Try to save record without filling any/some field(s). Try to issue membership ID that already exists. Try to delete/modify a member that has issued/reserved book(s). Try to renew expired membership. Results Display, field(s) left, message and set focus to unattended field. Display ID already exists. Display record exists in specified table. Prompt the user to renew the membership and increase the membership expiry date by two years if renewed. Display record no found. Evidence 49 50 51 52 and 53

Try to search the non-existing record. Try to enter numbers less than 7 and greater than 10 when check box is checked and try to enter a number when Validate Contact is unchecked or enter alphabet without character .. Delete the record successfully.

54

Display error message. Prompt the user to delete the record and delete if directed by user. Display the record in the relevant fields. Prompt the user whether or not to modify the record and change the record if directed. Export the data to Microsoft Word and allow printing it. Generate an auto ID for member and save the record after filling required fields. Display the record in grids. The selected record is exported into form view, from where the data can be modified.

55 and 56 57 and 58

Try to search the record. Try to modify grade of a member with ID 207 to 9. Try to print a library card. Add new record and save it successfully. Click on Grid View tab. Click on grid to edit the data.

59 and 60 61 62 -

Bishwanath Parajuli

105

Documentation for Easy Library Management System

Publisher and Author Details form:


Tests Try to add same author for a single book, twice. Try to add two publishers for a single book. Add new author and save it successfully. Add new publisher and save it successfully. Delete the author record successfully. Delete the publisher record successfully. Modify the author record. Modify the publisher record. Click on View Publishers and Authors tabs. Results Display record exists. Display record exists. Display saved message. Display saved message. Delete the author directed. Delete the publisher directed. Ask the user, whether to change the record and do as directed. Ask the user, whether to change the record and do as directed. Show the records of author and publisher in tabular form. Evidence 63 64 65 66 67 68 69 and 70 71 and 72 -

Supplier Details Form:


Tests Try to store a publisher that exists already. Store a supplier successfully. Delete a supplier. Modify the record. Try to search a data by clicking on search icon. Click on the mail icon. Results Display supplier already exists. Display record saved. Display an input box and delete the record if directed. Prompt the user to modify the record and do as directed. Display an input box to enter the supplier name to be found and display it. Open a window that allows sending email. Evidence 73 74 75 and 76 77 and 78 79 and 80 81

Bishwanath Parajuli

106

Documentation for Easy Library Management System

Search Form:
Tests Try to search data without entering/selecting search data. Try to view all the data in a particular table by selecting View all option. Select the search criteria, the search field, enter the search data and click on find icon. Open the sort form and try to sort the title of the book descending. Open the sort form and try to sort the title of the book ascending. Try to filter the first name of the member with initials b. Try to search a data by selecting View all option. Try to search data from the table that has no records. Try to sort or filter the data from a table not displayed currently. Results Display message, enter search data. Display all the data stored in the table in the grid and enable Sort button. Point the cursor towards the selected data. Sort the data descending in the search form. Sort the data ascending in the search form. Filter the data with initials b. Display error message. Display error message. Display error message. Evidence 82 83 84 85 86 87 88 89 90

Total fine Form:


Tests Try to calculate the total fine paid by a member, 206. Try to collect total fine. Results Display an input box to enter the member id and display the fine amount. Display a confirmation message and empty the table. Evidence 91 and 92 93

History Form:
Tests Try to view those books that were issued already. Check View Details box. Results Display the brief information on the left hand side of the window. Expand the form to tabular view. Evidence 94 -

Requested Book List form:


Tests Bishwanath Parajuli Results Evidence 107

Documentation for Easy Library Management System

Try to queue a book without filling the title of book. Try to request a book already requested. Try to request a book, Barron's SAT I, already in library. Try to delete the book SAT II from the queue. Try to store the data Basic Computing in queue. Try to print the data.

Display error message. Display error message. Display error message. Prompt the user to delete the book and show confirmation message if responded Yes. Populate the data into list box. Display a report window listing the name of the requested book.

95 96 97 98 and 99 -

Issue Overview Form:


Tests Try to view the books that will expire after 3 days. Results Highlight the expired book in red color. Evidence 100

Membership Overview Form:


Tests Try to view the membership that will expire on 10/20/2009. Results Highlight the expired membership in red color. Evidence 101

General Overview Form:


Tests Try to view the number of Teachers and Staffs who have become the member of library. Results Display the number of Teachers and Staffs Evidence 102

Database Utilities:
Tests Try to create a back up of database at the desktop. Try to restore the database from the desktop. Try to Compact and Repair database. Results Create a database backup and inform the user. Restore the database from the desktop. Reduce the size of the database and create a fresh copy. Results Evidence 103 -

Email Form:
Tests Evidence

Bishwanath Parajuli

108

Documentation for Easy Library Management System

Try to send mail without including @ or in address. Try to send mail to a supplier.

Display error message. Display a dialog box asking permission some cases only) (in

104 105

Security Form:
Tests Try to add user/change password/delete user without filling the text boxes. Try to add a user by entering unlike passwords. Try to add a user as Head Librarian. Try to add another user as Head Librarian. Try to change password for a non-existing user, Bijay. Try to set a new password for wrong old password. Try to set a new password by entering new unlike passwords. Try to change password for the user Rajeev from scythe to raj. Try to delete a non-existing user, Urgen. Try to delete user by entering wrong password. Try to delete a user Rajeev. Results Display error message. Display error message. Add the user. Display error message. Display error message. Display error message. Display error message. Display process completion message. Display error message. Display error message. Prompt the user to delete the username and display, process complete. Evidence 106 107 108 109 110 111 112 113 114 115 116 and 117

Preference Form:
Tests Select various option and click on Apply button. Results Apply the settings and carry out the directed activities. Evidence -

Bishwanath Parajuli

109

Documentation for Easy Library Management System

Reminders Form:
Results Display the books that have crossed their due date at startup if configured.

Mother Window:
Tests Unload the form when configured to compact or backup database Load the form, when a reservation has expired. Results Create a backup or compact the data base Display message. Evidence 119

Bishwanath Parajuli

110

Documentation for Easy Library Management System

8. Implementation:
Since the prevailing system of the school was very time consuming and troublesome, the user preferred direct implementation but some discussion with the end user lead him to implement the system in parallel mode. According to it, the user will maintain both, the computerized system and the manually system simultaneously. The three steps of the implementation plan of the system are given below: 1) Concise Course Training 2) Parallel Implementation 3) Full phase Implementation 1) Concise Course Training: Since the computerized system was very handy, the training period was very brief. The user required some illustrations about working out with the system. Besides, the user was well used to the packaged application such as word processors and database management system. The user will be made familiar about operating the main controls of the system. The user will also be given a brief introduction about various errors that could occur on different cases, especially during the ill management of the system such as database mishandling or destruction of the associated files. 2) Parallel Implementation: During direct implementation of the system, many faults may be discovered in the new system due to which serious problems of data loss may occur. So to prevent this sort of cases parallel implementation will be brought to use. The end user mainly will focus on the computerized system for data entry and will write the details manually too. Despite the time consumed on maintaining the entry of the transaction both the way, the user will be able to compare the effectiveness of the system at end and will be able to move towards the full phased implementation.

Bishwanath Parajuli

111

Documentation for Easy Library Management System

3)

Full phase Implementation: After the satisfactory results from parallel implementation, the user will move to

depend upon the new computerized system fully.

Bishwanath Parajuli

112

Documentation for Easy Library Management System

8.1 Evidence of the acceptance of the implementation:


The evidence of the acceptance of the implementation of the system has been included in Appendix I.

8.2 System Changeover:


The system changeover was carried out according to the implementation plan mentioned above. The evidence of acceptance of the new system has been included in Appendix I.

Bishwanath Parajuli

113

Documentation for Easy Library Management System

9. Appropriateness of structure and exploitation of available facilities:


After the implementation plan was designed, the available hardware and software solution had to be checked thoroughly. The system that was available in the school was a Pentium-3 computer with the processor speed of 722 MHz, total physical memory of 192 MB and Windows XP as the main operating system. Besides these, it had an optical mouse, an optical drive (52X CD-ROM) and an old dot-matrix printer to print hard copy output. All of these facilites were as per the system requirements mentioned above. However, the system lacked two main accessories mentioned above in the requirement: 1) a keyboard, 2) Microsoft Office Package and 3) Printer 1) Keyboard: After the above study was completed, the library had to have a keyboard. The keyboard was, however, not a great problem since the keyboard cost just around Rs.300 and the institution easily managed the keyboard. The library had a keyboard just after a day. 2) Microsoft Office Package: As keyboard, the institution easily got rid of this problem too since it had a CD of Microsoft Office pakage. The software was easily installed into the computer and this problem was solved too. 3) Printer: Although the library had a printer, this printer was not capable of printing graphic required for printing the library card and the institution wasnot willing to spend money in a printer (which is expensive; about Rs 25000) just for printing library card that they already had. Therefore, an agreement was reached, to use the old library card for maintaing the records of the member. In this way, the resources were exploited.

Bishwanath Parajuli

114

Documentation for Easy Library Management System

10. Evaluation of the degree of success of the system over its objectives:
Allow the authorized user to add new records regarding books, members, publisher, author and suppliers, and allow editing/removing them. Reference: Appendix II, Evidence No. 6.1, 6.2, 6.3 Allow easier and convenient searching of data from various data tables. Reference: Appendix II, Evidence No. 82-87 Allow the authorized user to carry out routine library tasks such as issue, renew/return and reserve. Reference: Appendix II, Evidence No. 6.1, 6.2, 6.3 Allow only authorized user to get into the system and allow provision for a single administrator only. Reference: Appendix II Allow to add new authorized users according to the rights specified. Also, provide the feature of deleting the user or changing the password. Reference: Appendix II, Evidence No. 106-117 Allow the administrator to control all the library tasks. Also, allow provision of General User who can carry out major library tasks in absence of administrator. Reference: Appendix II Prevent the user from issuing a reference book. Reference: Appendix II, Evidence No. 8 Prevent from issuing reserved books, issuing more than three books at a time or issuing same book at a time. Allow the same provision in reserving. Reference: Appendix II, Evidence No. 10, 11, 12 Prevent the member from issuing, reserving, renewing or returning the book who has fine to pay or whose membership has expired. Reference: Appendix II Allow the user to cancel reservation if demanded.

Bishwanath Parajuli

115

Documentation for Easy Library Management System

Reference: Appendix II, Evidence No. 34, 35 Prompt the authorized user to cancel the reservation, if made, while the borrower is about to issue reserved book. Reference: Appendix II, Evidence No. 17 Cancel all the reservation that has crossed its due date at the startup of the program. Reference: Program Listings Allow automatic calculation of the fine and allow printing a fine report. Reference: Appendix II, Evidence No. 91, 92, 93 Only allow the administrator to collect the total fine. Reference: Appendix II Prompt the authorized user to collect and clear fine (No partial payment allowed) from the borrower if any borrowed book has crossed its due date. Reference: Appendix II, Evidence No. 18, 19 Allow printing/viewing the details of the member, books, reservation and due books in the form of reports. Reference: Appendix II, Evidence No. 118 Allow viewing the due books at startup, if configured. Reference: Appendix II Allow to contact the suppliers through the means of email. Reference: Appendix II, Evidence No. 104, 105 Allow viewing the history of issued books for further reference. Reference: Appendix II, Evidence No. 94 Allow the authorized user to keep the records of book requested in the library. Reference: Appendix II Allow the authorized user to view issued books and membership status of the borrower. Reference: Appendix II, Evidence No. 100, 101

Bishwanath Parajuli

116

Documentation for Easy Library Management System

10.1 The Framework:


In context of the framework, the solution has completed the following aspects: The database is fully designed, implemented and tested. The basic operation of the forms has been designed successfully. The user access control has been developed up to functioning. The required data grid and form have been developed in the IDE of Visual Basic 6.0.

Bishwanath Parajuli

117

Documentation for Easy Library Management System

11. Evaluation of users response to the system:


11.1 Convenience:
The system is quite user friendly and it consists no vital errors. The new system has enhanced the working pace in the library. The user interface of the new system is also very apparent.

11.2 Evidence:
The written evidence from the user has been included in Appendix I.

Bishwanath Parajuli

118

Documentation for Easy Library Management System

12. Future Enhancements:


No software is ever complete and no software is ever bugged free. There is always a list of components that could be added to the current system. A list of these desirable extensions is presented below: 1. Development of support for bar-code system for long-term use 2. Use of a more secured database solution such as SQL or Oracle 3. Development of the networked system 4. Provision of E-notice board and feature of keeping records of the books to be sent for repairing 5. Provision of partial payment while charging fine 6. System of salary management of the staffs associated with library. The new computerized system has solved the ongoing library task and made the routine task easier and faster. No errors that have been reported or detected since the software was handed to the third party user. Hence, Easy Library Management System has met its objectives.

Bishwanath Parajuli

119

Documentation for Easy Library Management System

13. Documentation:
13.1

Technical Documentation:

This document includes all the technical aspects of Easy Library Management System. It includes database specifications and list of all the codes.

Back End:
The back-end of this application is created with Microsoft Access (Library Management System.mdb). The list of the tables and queries along with their description are listed below:

List of Tables
Name of Table Description

Bishwanath Parajuli

120

Documentation for Easy Library Management System

tblbookdetails:
Field Book_Code (Primary Key) Title Edition Type_of_Book Number_of_Copies Published_Year ISBN Price Shelf_Number Data Type Long Integer Text (Max Size=80) Text (Max Size=25) Text (Max Size =15) Long Integer Long Integer Text (Max Size =13) Long Integer Long Integer Description A unique code assigned to each book (auto-number). Stores the title of the book Stores the edition of book Stores the book type Stores the total number of copies of the book in library Stores the year when the book was published Stores the ISBN of the book Stores the total price of the book Stores, to which shelf the book belongs

tblmember:
Field ID (Primary Key) First_Name Middle_Name Sur_Name Date_of_Birth Education_Level Contact Gender Activation_Date Expiry_Date path Data Type Long Integer Text (Max Size=30) Text (Max Size=30) Text (Max Size=30) Date/Time Text (Max Size=20) Text (Max Size=30) Text (Max Size=6) Date/Time Date/Time Text (Max Size=30) Description A unique number assigned to each member. (auto-number) Stores the initial part of the borrowers Name. Stores the middles of the borrowers name Stores the sur name of the borrowers name Stores the birth date of the borrower Stores the grade or category of the borrower Stores the contact number/address of borrower Stores the information of gender of borrower Stores the membership activation date of the borrower Stores the membership expiry date Stores the path for picture of the borrower

Bishwanath Parajuli

121

Documentation for Easy Library Management System

tblusers:
Field User_Name (Primary Key) User_Type Password Data Type Text (Max Size=8) Text (Max Size=30) Text (Max Size=8 Description Stores the username of a user Stores the user type Stores password for the user

tblauthor:
Field Author_ID (Primary Key) Author_Name Contact Country Book_ID Book_Title Data Type Long Integer Text (Max Size=60) Text (Max Size=100) Text (Max Size=25) Long Integer Text (Max Size=80) Description Stores the unique ID for each author(auto-code) Stores the name of author Stores the contact number/ web-address of the author Stores the name of the country the author belongs Stores the book code of the authors book Stores the book title of the authors book

tblpublisher:
Field Publisher _ID (Primary Key) Publisher_Name Contact Book_ID Book_Title Data Type Long Integer Text (Max Size=60) Text (Max Size=100) Long Integer Text (Max Size=80) Description Stores the unique ID for each publisher(auto-code Stores the name of publishers title Stores the contact number/web-address of the publisher Stores the book code of the book published by it Stores the book title of the book published by it

tblreserve:
Field Reservation_ID (Primary Key) Book_Code Borrower_ID Reservation_Date
Date_Cancel_Reserve

Data Type Long_Integer Long Integer Long_Integer Date/Time Date/Time

Description Stores a unique ID for each reservation (auto-code) Stores the book code of the reserved book Stores the ID of the borrower Stores the date when the reservation was made Stores the date when the reservation cancels

Bishwanath Parajuli

122

Documentation for Easy Library Management System

tblissue:
Field Name Issue_ID (Primary Key) BookCode Borrowers_ID Date_of_Issue Returning_Date Student_Memo Status Book_Type Data Type Long Integer Long Integer Long Integer Date/Time Date/Time Text (Max Size=30) Text (Max Size=3) Text (Max Size=12) Description Stores a unique number (auto-code) for every issue that is made Stores the code assigned for each book (Mandatory) Stores the ID assigned to member making the issue(Mandatory) Stores the issue date (System Date) Stores the returning date of the issued book Stores about the borrowing activity of the student Stores the whether the book has crossed its due date or not. Stores the type of book

tblfine:
Field Name Fine_ID (Primary Key) Book_Code Member_ID Overdays Fine(Rs) Data Type Long Integer Long Integer Long Integer Text (Max Size=15) Long Integer Description Stores a unique ID (auto-code) for each fine record Stores the book code of the borrowed book that has crossed its due date Stores the member ID of the member who needs to pay fine Stores the number of days after the due date, until the book had been returned Stores the total fine amount for the member

tblorderbooklist:
Field Name Book_Title (Primary Key) Data Type Text (Max Size=80) Description Stores the title of the requested book

tblsupplier
Field Name Supplier_ID (Primary Key) Supplier Address Contact Data Type Long Integer Text (Max Size=80) Text (Max Size=80) Text (Max Size=40) Description Stores a Unique ID (auto-code) for every supplier Stores the name of the supplier Stores the address of the supplier Stores contact number/web-address of the supplier.

Bishwanath Parajuli

123

Documentation for Easy Library Management System

tblsettings:
Field Name Quickbook Quickmem Compact Inform Backup Data Type Text (Max Size=5) Text (Max Size=5) Text (Max Size=5) Text (Max Size=5) Text (Max Size=5) Description Stores data, whether to show frmreminders Stores data, whether to show frmovmem Stores data, whether to compact the database at the termination of the application Stores data, whether to tell the user about the total fine collected when the application loads. Stores data, whether to backup the database at the termination of the application

tblhistory:
Field Name History_Code (Primary Key) Book_ID Member_ID Issue_Date Returned_Date Comments Data Type Long Integer Long Integer Long Integer Date/Time Date/Time Text (Max Size=30) Description Stores a unique code for the storing an issue done in the past Stores the book code for the book issued in the past. Stores the member id for the member that issued book(s) in the past Stores the date when issue was made Stores the date when the book was returned Stores the comments on the borrower

Bishwanath Parajuli

124

Documentation for Easy Library Management System

List of Queries
Query Description

Query

SQL Code
SELECT tblissue.BookCode, tblbookdetails.Title, tblissue.[Borrower's_ID], ([First_Name] & " " & [Middle_Name] & " " & [Sur_Name]) AS Name, tblissue.Date_of_Issue, tblissue.Returning_Date

qryissue

FROM tblmember INNER JOIN (tblbookdetails INNER JOIN tblissue ON tblbookdetails.Book_Code = tblissue.BookCode) ON tblmember.ID = tblissue. [Borrower's_ID]; SELECT tblbookdetails.Book_Code, tblbookdetails.Title, tblbookdetails.Type_of_Book, tblmember.ID, ([First_Name] & " " & [Middle_Name] & " " & [Sur_Name]) AS Name, tblmember.Contact, tblfine.Overdays, tblfine.[Fine(Rs)] FROM (tblfine INNER JOIN tblbookdetails ON tblfine.Book_Code=tblbookdetails.Book_Code) INNER JOIN tblmember ON tblfine.Member_ID=tblmember.ID; SELECT tblreserve.Book_Code, tblbookdetails.Title, tblreserve.Borrower_ID, ([First_Name] & " " & [Middle_Name] & " " & [Sur_Name]) AS Name, tblreserve.Reservation_Date, tblreserve.Date_Cancel_Reserve

qryfine

qryreserve

FROM tblmember INNER JOIN (tblbookdetails INNER JOIN tblreserve ON tblbookdetails.Book_Code=tblreserve.Book_Code) ON tblmember.ID=tblreserve.Borrower_ID; SELECT tblissue.BookCode, tblbookdetails.Title, tblbookdetails.Type_of_Book, tblissue.[Borrower's_ID], ([First_Name] & " " & [Middle_Name] & " " & [Sur_Name]) AS Name, tblmember.Expiry_Date, tblissue.Date_of_Issue, tblissue.Returning_Date, tblissue.Status

qrydue

FROM tblmember INNER JOIN (tblbookdetails INNER JOIN tblissue ON tblbookdetails.Book_Code=tblissue.BookCode) ON tblmember.ID=tblissue. [Borrower's_ID] WHERE (((tblissue.Status) Like 'No'));

Bishwanath Parajuli

125

Documentation for Easy Library Management System

Query

SQL Code
SELECT tblhistory.History_Code, tblhistory.Book_ID, tblbookdetails.Title, tblhistory.Member_ID, ([First_Name] & " " & [Middle_Name] & " " & [Sur_Name]) AS Name, tblhistory.Issue_Date, tblhistory.Returned_Date, tblhistory.Comments FROM tblmember INNER JOIN (tblbookdetails INNER JOIN tblhistory ON tblbookdetails.Book_Code=tblhistory.Book_ID) ON tblmember.ID=tblhistory.Member_ID; SELECT tblbookdetails.Book_Code, tblbookdetails.Title, tblbookdetails.Edition, tblbookdetails.Number_of_Copies, tblbookdetails.Published_Year, tblbookdetails.Price, tblbookdetails.Shelf_Number, tblpublisher.Publisher_Name, tblauthor.Author_Name FROM (tblbookdetails INNER JOIN tblauthor ON tblbookdetails.Book_Code=tblauthor.Book_ID) INNER JOIN tblpublisher ON tblbookdetails.Book_Code=tblpublisher.Book_ID;

qryhistory

qrybookdetails

Bishwanath Parajuli

126

Documentation for Easy Library Management System

Entity Relationship Diagram

Note:
(Line) denotes relationship. denotes many relationships. denotes single relationship. denotes one to one relationship. denotes one to many relationship. The bold digits signify a primary key. Each box is a symbolic representation of the table. The boxes, not joint by line, show they dont have any relationship.

Bishwanath Parajuli

127

Documentation for Easy Library Management System

Dataflow Diagram of the Proposed System


Book Details
Book id, Book title, ISBN, Author, Publisher, e.t.c If the member did not issue/reserve a book or the member did not issue/reserve the same book.

Member Details
Member id, Name, Gender, Grade, Membership Expiry date, e.t.c

Issue book
Memberid, Name, Bookid, Title, etc

Check if the book is reserved.

Reserve a book
Memberid, Name, Bookid, Title, etc

Check membership status or any fine left to pay.


If book crosses its due date If membership expires

Members Details
If membership expires

Calculate fine Rs. 2 until 7 days and Rs. 5 for rest of the time. Memberid, Name, Bookid, Title, etc

The user renews membership of the member.

Prepare the book so that it can be issued again

Requested Books Details Title of book


Title

Display Report

Bishwanath Parajuli

128

Documentation for Easy Library Management System

System Flowchart: Issuing a book


Begin Input book code and member id Is the data invalid?
No Yes

Display error message

Issued three books or issued the book already and have fine to pay

Yes

Display error message

No

Has the book been reserved?


No

Yes

Display error message

Generate codeusing record postion. Save the data in relevant fields End Bishwanath Parajuli 129

Documentation for Easy Library Management System

System Flowchart: Reserving book


Begin Input book code and member id Is the data valid?
No Yes

Display error message

Reserved three books or reserved the book already and have fine to pay

Yes

Display error message Calculate fine if needed

No

Has all books been issued?


No

Yes

Display error message

Generate codeusing record postion. Save the data in relevant fields End Bishwanath Parajuli 130

Documentation for Easy Library Management System

System Flowchart: Renewing/Returning a book


Begin Input book code and member id

Membership expired or has fine to pay


No

Yes

Display error message

No

Crossed due date?


Yes

Increase the return date of the book, if renewed and delete the book from issue table to return the book. Sort data according to keyfield If returned, save the data in the history table. End

Calculate fine

Sort data according to keyfield Save fine details in fine table

Bishwanath Parajuli

131

Documentation for Easy Library Management System

Data Dictionary:
Name of Variable Variable Type Data Type Purpose

lpExistingFileName lpNewFileName bFailIfExists connect precord, bdrecord, mrecord, lrecord, brecord, hrecord, srecord, nrecord result stTempDBfile origin, final checkb, checkblank Control vali last deletedata find wa wd expire frmsOutlook frmsMailItem id fine lstitem check (frmissue), idcheck countn, countr, br a checklib ColumnHeader recno, codeno countissue check (frmreserve) dater X, Y supname checkmem, checkbook Bishwanath Parajuli

Global Global Global Global Global Private Private Private Public Private Private Private Private Private Private Private Private Private Private Private Private Private Public Private Private Public Private Private Private Public Private Private Private Private

String String Long ADODB connection ADODB recordset String Long Boolean Object String String Integer Integer/String Word Application Word Document Object Object Integer Integer ListItem Boolean Integer Integer Boolean
MSComctlLib ColumnHeader

System Variable System Variable System Variable Specifies data path & provider Specifies the record table and type Stores name of the backup/restore Stores name of existing file Stores size of old/new file Stores if any field is blank Signifies the field Stores the name/code of book Stores the last letter of the field Stores member ID to be deleted Stores the data to be found Declares MS Word application Declares MS Word document Stores the difference in 2 dates Specifies MS Outlook application Specifies MS Outlook document Stores the member ID to be found Stores calculated fine Specifies items in list view Matches data to conditions to borrow/reserve book Stores number of reserved book Stores if current book is already issued/reserved by the member Checks if Head Librarian exists Stores column index of list view Stores the ID/ name of author/publisher respectively Stores number of issued books
Checks if member had reserved book

String Integer Boolean Date String String String

Stores date retrieved from source Stores date converted to integer Stores name/code of supplier Stores the data retrieved from tblsettings for show/hide form(s) 132

Documentation for Easy Library Management System

Note: o Variables like count (integer), i (integer), code (integer/string/long) etc are used in many forms for different purposes so they are not included in above table. o Variables used in frmAbout too, are not included in the above table.

Bishwanath Parajuli

133

Documentation for Easy Library Management System

Front End:
Mother Window (mdimain)

Bishwanath Parajuli

134

Documentation for Easy Library Management System

Control(s) mnuexit mnubackupdb mnucompactandrepairdb mnurestore mnuhlp Other menus (Form) (Form) mditime cmdissue cmdexpmem cmdrequest Control(s) tbrmain tbrmain tbrmain

Event(s) Click Click Click Click Click Click QueryUnload Load Timer Click Click Click

Purpose/Description Terminate the form. Create a backup. Initialize DAO and DBEngine to compact and repair database. Copy the specified file from the specified location to application path. Open the help file, Easy Library Management System.hlp, associated to this application. Open the respective forms. Call functions; backupdatabase and CompactCurrentDatabase, if indicated. Update the value of the 12th field of tblissue and 4th field of tblreserve. Display time in Status Bar Display form to view issued books. Display form to view expired membership. Display form to view requested books.

Event(s) Button Menu Click Button Click Button Menu Click (Change User)

Purpose Open respective forms as mentioned in caption. Open respective forms as mentioned in caption. Hide mdimain and display frmLogin.

Functions:
Name of Function backup compact Purpose Make a copy of database in required path. Initialize DAO.DBEngine to compact and repair database.

Bishwanath Parajuli

135

Documentation for Easy Library Management System

Input Data:
Book Details (frmbookdet)

Field(s) txtcode txttitle txtedition txtdatep, txtcopies, txtprice, txtsno, txtvolume cmdaddnew

Events Change DblClick KeyPress LostFocus LostFocus KeyPress Click KeyPress

Purpose Show cmdchange and unlock txtcode if txtcode is not empty. Enable fracontrols, franavigate, cmdclear, txttitle; unlock txtcode, if locked; show cmdchange, if hidden. Allow numeric characters only. Check whether the title exists already and display message, if found. Extract last letter from txtedition and assign specified letters to value in the box. Allow numeric characters only. Assign a code (auto-number) for the book and allow saving new record. Shift the focus to txtcode.

Bishwanath Parajuli

136

Documentation for Easy Library Management System

cmdsave cmddelete cmdcancel cmdmodify cmdsearch cmdchange cmdclear cmdbegin, cmdprevious, cmdnext, cmdlast booktimer tabs bookgrid Form

Click Click Click Click Click Click Click Click Timer KeyPress Click Load

Call function checkblanks and enablecontrols. Store the record in tblbookdetails. Delete the record from tblbookdetails. Cancel process of adding new book. Edit the data stored in tblbookdetails except book code. Find the data through ID or title of the book. Change the code of the book. Reset all the textboxes. Move to first record, previous record, next record and last record, respectively. Refresh Adodc, adobook and Datagrid, bookgrid. Set focus to cmdaddnew, if Form View tab is selected, on pressing [Enter]. Load the selected information into textboxes in Form View tab, from the Datagrid, bookgird. Call the functions required by the form and configure adobook from tblbookdetails.

Functions:
Name of Function enablecontrols disablecontrols checkrecords clear display Purpose Enable/disable the command buttons and franavigate. Enable/disable the command buttons and franavigate. Check whether the tblbookdetails is empty and if empty disable franavigate. Reset all the textboxes. Extract the data from tblbookdetails and show the data in assigned fields.

Bishwanath Parajuli

137

Documentation for Easy Library Management System

Borrowers Detail (frmborrowerdetails):

Field(s) txtbrid txtfname, txtsname txtcontact chkrestrict lbldatee frapicture memimage cmdfind cmdaddnew cmdsave cmdcancel cmddelete cmdmodify

Event(s) LostFocus Change LostFocus Click Change Click Click Click Click KeyPress Click Click Click Click

Purpose Check whether the ID exists already and display if found. Display the text written on the text boxes in lblfname and lblsname. Call function, checkrestrict. Call function, checkrestrict. Check whether the date displayed on the label is greater or smaller than system date. Clear the image displayed in memimage and lblpic, which contains the address of the picture file. Open common dialog-box; display the selected image in memimage and save the picture in application path. Displays an input-box to enter an ID to be found. Generate a member ID and membership acquired date and allow saving new record. Shift focus to txtbrid. Save the record of the details in tblmember. Cancel adding new record in database. Display a input box to enter the member ID and delete the member if found. Edit the data in tblmember.

Bishwanath Parajuli

138

Documentation for Easy Library Management System

cmdprint gridtimer expiredtime cmdclear memebergrid tabs cmdbegin, cmdprevious, cmdnext, cmdlast Form

Click Timer Timer Click Click KeyPress Click Load Unload

Open Microsoft Word and export required data like members name, grade, etc. to allow the user to print a library card. Refresh Adodc adomember and memebergrid. Change the background color of picx if membership has expired. Reset all the textboxes, option buttons, etc. Load the selected information into textboxes in Form View tab, from the Datagrid - memebergrid. Shift focus to cmdaddnew if [Enter] is pressed. Move to first record, previous record, next record and last record, respectively. Call all the required functions and configure adomember. Unload frmreserve, frmissue and frmrnunreturn.

Functions:
Name of Function enablenavigation disablenavigation checkblanks checkrecords clear display checkrestrict Purpose Enable/disable the command buttons and franavigation. Enable/disable the command buttons and franavigation. Check if any field is left unchecked. Check whether the tblmember is empty and if empty disable franavigate. Reset all the textboxes. Extract the data from tblmember and show the data in assigned fields. Check if txtcontact contains, the character @ or ., while chkrestrict is unchecked and contains 7-10 character, if chkrestrict is checked.

Bishwanath Parajuli

139

Documentation for Easy Library Management System

Publisher and Author Details (frmpubnauth):

Bishwanath Parajuli

140

Documentation for Easy Library Management System

Field(s) cmbcode txtauthname, txtpubname txtauthcontact txtcountry txtpubcontact cmdsaveauth, cmdsavepub

Event(s) Click KeyPress LostFocus KeyPress KeyPress KeyPress

Click Click

cmdaddnew, cmdnewpub cmdcancelauth, cmdcancel cmddelete, cmddeletep cmdmodifyauthor, cmdmodifypub cmdpub cmdauth cmdbeginauth., cmdpreviousauth, cmdnextauth, cmdlastauth, cmdbeginpub, cmdpreviouspub, cmdnextpub, cmdlastpub timeauth timepub Form

KeyPress Click Click Click Click Click Click

Purpose Load title of book into lbltitle. Shift focus to txtauthcontact or txtpubcontact if [Enter] pressed, according to the button pressed. Check for repetition of author or publisher name. Shift focus to txtcountry on pressing [Enter]. Shift focus to cmdsaveauth on pressing [Enter]. Use Instr function to modify the data in the textbox if required criteria are met, on pressing [Enter]. Call function, clear, disable, checkauthrecords and save record in tblauthor; Shift focus to cmdaddnew on pressing cmdsaveauth. Else call function, clear, disable, checkpubrecords and save the data into tblpublisher and shift focus to cmdnewpub. Generate an author ID / publisher ID (auto number) and allow adding new record. Shift focus to txtauthname if cmdaddnew is pressed. Else, shift focus to txtpubname, on pressing [Enter]. Cancel adding new data into tblauthor on pressing cmdcancelauth. Else, cancel adding new data into tblpublisher on pressing cmdcancel. Delete the author if cmddelete is pressed or publisher if cmddeletep is pressed. Allow modifying data in tblauthor or tblpublisher, respectively. Show pubgrid for publisher detail and show cmdauth. Show authgrid for author detail and show cmdpub. Move to first record, previous record, next record and last record, respectively. Move to first record, previous record, next record and last record, respectively. Refresh authgrid and adoauth. Refresh pubgrid and adopub. Configure adopub, adoauth and call the functions required by the form.

Click Timer Timer Load

Bishwanath Parajuli

141

Documentation for Easy Library Management System

Functions:
Name of Function checkpubrecords checkauthrecords viewdatapub viewdataauth enable disable clear Purpose Check whether the tblpublisher is empty and if empty disable franavigatepub. Check whether the tblauthor is empty and if empty disable franavigateauth. Extract the data from tblpublisher and show the data in assigned textboxes. Extract the data from tblauthor and show the data in assigned fields. Enable/disable the command buttons. Enable/disable the command buttons. Reset all the textboxes.

Bishwanath Parajuli

142

Documentation for Easy Library Management System

Supplier Details (frmsupplier)

Field(s) txtsname chkdet suppliertimer cmdbegin, cmdprevious, cmdnext, cmdlast cmdmail cmdrefresh cmdsearch cmdsave cmddelete cmdmodify Form

Event(s) LostFocus Click Timer Click Click Click Click LostFocus Click Click Click Load

Purpose Check whether the supplier name already exists in the database. Allow viewing supgrid, if checked. Refresh and configure adosupplier and supgrid after adding/deleting the data. Move to first record, previous record, next record and last record, respectively. Open frmemail and exports the address in txtcontact into the form, to allow sending mails to the supplier. Resets all the textboxes Opens an inputbox to allow entering supplier name/code so that the required supplier can be searched. Hide cmdsearch button. Save the supplier into tblsupplier. Delete the supplier record from tblsupplier. Allows the user to edit the supplier record from tblsupplier. Call the functions required by the form and configure adosupplier.

Functions:
Bishwanath Parajuli 143

Documentation for Easy Library Management System

Name of Function checknavigation viewdata

Purpose Check if tblsupplier is empty and if so disable franavigate. Extract required data from tblsupplier and display in assigned fields.

Bishwanath Parajuli

144

Documentation for Easy Library Management System

Book List (frmbooklist):

Field(s) txtnew cmdorder cmdprint lstbook Form

Event(s) LostFocus Click Click DblClick Load

Purpose Call the functions; checkrepeat and checklist. Stores the record/book name in tblorderbooklist. Opens a report window that contains the list of the books, requested in the library. Allows removing the selected book from tblorderbooklist. Configure ADODB connection and call the required functions.

Bishwanath Parajuli

145

Documentation for Easy Library Management System

Security (frmnuserandcpass)

Field(s) txtusername cmbusertype txtpassword txtcpassword cmdaddnewuser txtuser txtopass txtnpass txtcpass cmdchngpass txtusern txtpassd cmddelete cmdclear, cmdclear1 Form

Purpose If [Enter] is pressed, shift focus to cmbusertype. If [Enter] is pressed, shift focus to txtpassword. Checks whether user with same name already exists. If [Enter] is pressed, shift focus to txtcpassword. If [Enter] is pressed, shift focus to cmdaddnewuser. Check whether txtpassword and txtcpassword matches and if matched, store in tblusers. Shift focus back to txtusername. KeyPress If [Enter] is pressed, shift focus to txtopass. GotFocus Check whether the username exists in the database. KeyPress If [Enter] is pressed, shift focus to txtnpass. GotFocus Check whether the password exists in the database. KeyPress If [Enter] is pressed, shift focus to txtcpass. LostFocus Check whether the text in txtnpass and txtcpass matches. KeyPress If [Enter] is pressed, shift focus to cmdchngpass. If txtuser and txtopass match with database record, update the Click Password field of tblusers with txtnpass. If [Enter] is pressed, shift focus to txtpassd. KeyPress If [Enter] is pressed, shift focus to cmddelete. GotFocus Check whether the username exists in the database. GotFocus Check whether the password matches with that on tblusers. Click Delete the username from database and shift focus to txtusern. Click Reset all the textboxes. Load Call all the function required by the tblusers.

Event(s) KeyPress KeyPress GotFocus KeyPress KeyPress Click

Bishwanath Parajuli

146

Documentation for Easy Library Management System

Functions: Name of Function clearallfields checklibrarian Purpose Clear all textboxes. Clear and fill items into cmbusertype. Check if an Administrator already exists.

Bishwanath Parajuli

147

Documentation for Easy Library Management System

Processing Data:
Issue Form (frmissue)

Field(s) cmbbid cmbbrid cmdsave cmdclear lbltype Form

Event(s) Click Got Focus Click Click Got Focus Click Change Load

Purpose Load title, type and returning date of the book. Call functions bremain and clear Load issue ID (auto number). Load name and photo of the member. Call functions check_reserve and clear. Save the required data about the issue in tblissue. Call functions borrower_check and clear Load text No comments on txtmemo if empty. Call function, clear, to reset all the fields. Specify the date of issue according to the text displayed. Load different sub procedures and functions.

Functions:
Name of Function additemid check_reserve borrower_check bremain clear Purpose Add book code and member ID into cmbbrid and cmbbid. Check reservation details of the book. Check details of the borrower including fine left to pay. Check remaining copies of book that can be issued. Reset all the labels, combo-boxes and text-box.

Bishwanath Parajuli

148

Documentation for Easy Library Management System

Renew/Return Form (frmrnunreturn)

Field(s) cmbbrid

Event(s) Click KeyPress Click

cmbcode cmdrenew cmdreturn chkdetails cmdcollect mnulinker Form KeyPress Click Click Click Click Click Load

Purpose Load name, contact, membership expiry date and photo of the member. Call functions check_expire. Shift focus to cmbcode, if [Enter] is pressed.. Load title, issue and returning date of the book. Call functions bremain and clear Shift focus to cmdrenew or cmdreturn, if [Enter] is pressed. Update the value of 4th field of tblissue, if found. Delete the record from tblissue, if found. Expand the form view if checked and constrict when unchecked. Delete the record from tblissue and store the required information in tblfine for further processing. Holds a shortcut [Delete] for loading frmlinker. Call all the functions, required by the form; clear and add item into cmbbcode and cmbbrid.

Bishwanath Parajuli

149

Documentation for Easy Library Management System

Functions:
Name of Function list finecalc structure restructure check_expire checkid history Purpose Add item into list view (lstview). Calculate due days and the total fine the borrower has to pay. Show frafine and change its position. Hide frafine and change its position. Check if membership has expired. Check if the borrower has fine to pay and if the book to be renewed is reserved then cancel renewing process. Save required information about the issue, made into tblhistory, for future reference.

Bishwanath Parajuli

150

Documentation for Easy Library Management System

Reservation Form (frmreserve)

Field(s) cmbbcode cmbsid

Event(s) Click Got Focus KeyPress Click KeyPress Click

cmdreserve cmdcancelres cmdreserved cmdbook chkdet timereserve Form Click Click Click Click Timer Load

Purpose Load title of book and check whether the book is available. Enable cmbsid. Shift focus to cmbsid, if [Enter] is pressed. Load name of the borrower and call functions borrower_check, fine_check and mem_check. Shift focus to cmdreserve, if [Enter] is pressed. Obtain an auto ID for reservation; call functions check_issue, borrower_check, fine_check and mem_check and save the reservation. Shift focus to cmbbcode. Delete the record form tblreserve. Show reservegrid. Show bookgrid. Change the height of the form. Refresh Adodc, adoreserve and Datagrid, reservegrid. Call the functions required by the form.

Bishwanath Parajuli

151

Documentation for Easy Library Management System

Functions:
Name of Function check_issue mem_check borrower_check cmbid fine_check Purpose Check if the member already issues the book. Check if membership has expired. Check if the member ahs already reserved the book or reserved 3 books. Add item into cmbbcode and cmbsid. Check if the member has fine to pay.

Bishwanath Parajuli

152

Documentation for Easy Library Management System

Login Window (frmLogin)

Field(s) cmdcancel cmdok Form

Event(s) Purpose Click Unload frmLogin and mdimain. Configure the settings, enabling and disabling the menu items Click according to the user that has logged in, displaying the user name in status bar (sbrmain) of mdimain. Load Call all the functions required by frmLogin.

frmlinker:

Field(s) optrenew optreturn

Event(s) Click Click

Purpose Open frmrnunreturn, display cmdrenew and hide cmdreturn. Open frmrnunreturn, display cmdreturn and hide cmdrenew.

Bishwanath Parajuli

153

Documentation for Easy Library Management System

Preference (frmprefer):

Field(s) cmdcancel cmdapply Form

Event(s) Click Click Load

Purpose Unload the form. Save the settings into tblsettings. Initialize the settings saved into tblsettings.

Bishwanath Parajuli

154

Documentation for Easy Library Management System

Send Mails (frmemail)

Field(s) txtadd cmdsend

Event(s) LostFocus Click

Purpose Checks whether the character . and @ are present in the text written in txtadd. Export the data to Microsoft Outlook for sending mail item.

Bishwanath Parajuli

155

Documentation for Easy Library Management System

frmSplash:

Field(s) Timer1 Timer2 Form

Event(s) Timer Timer Load Unload

Purpose Manage the value of ProgressBar2. At maximum value unload the form, and show mdimain. Hide/Show shp1, shp2, shp3 and shp4. Call all the required functions. Load the settings from tblsettings and carry out operations; calculating total fine, showing/hiding frmreminders and frmovmem, accordingly.

Bishwanath Parajuli

156

Documentation for Easy Library Management System

Output Data:
Total Fine (frmfine):

Field(s) chkdet finetime cmdcollect cmdcalculate Form

Event(s) Click Timer Click Click Load

Purpose Allow viewing finegrid by expanding the form. Configure and refresh adofine and finegrid. Delete all the records from tblfine. Display an inputbox to calculate the sum of 7th field of qryfine if matched with searched data. Call all the functions required by the form and display the sum of Fine (Rs) field in lblfine.

Search (frmsearch):
Bishwanath Parajuli 157

Documentation for Easy Library Management System

Field(s)

Event(s)

Purpose

Bishwanath Parajuli

158

Documentation for Easy Library Management System

optissue optmem optbook optauth optpub optreserve optdaters, optfname, optisbn, optmid, optpid, optpname, optsid, optsno, optaid, optaname, optbcode, optbid, optbtitle, optdatea, optdatei, optdater optgender, optlevel, opttype optrall, optaall, optball, optiall, optmall, optpall cmdsearch cmdsort Form

Click Click Click Click Click Click

Show and enable frame (fraissue) only. Show and enable frame (framem) only. Show and enable frame (frabook) only. Show and enable frame (fraauth) only. Show and enable frame (frapub) only. Show and enable frame (frares) only.

Click Click

Call the function textboxvisible.

Call the function combovisible. Fill the combobox (cmbtype) with the texts specified. Click Configure Adodc1, with the tables or queries, as specified. Click Configure Adodc1 to search data. GotFocus Enable cmdsort if txtsearch is not empty. Click Open frmsort and disable frmsearch. Load Configure Adodc1.

Functions:
Name of Function disable1 disable2 disable3 disable5 disable6 disable7 textboxvisible combovisible typeb typel typeg Purpose Show and enable fraissue only from frasearch. Show and enable frabook only from frasearch. Show and enable framem only from frasearch. Show and enable fraauth only from frasearch. Show and enable frapub only from frasearch. Show and enable frares only from frasearch. Show/enable txtsearch and hide/disable cmbtype. Show/enable cmbtype and hide/disable txtsearch. Clear cmbtype and add specified item into it. Clear cmbtype and add specified item into it. Clear cmbtype and add specified item into it.

Sort (frmsort):
Bishwanath Parajuli 159

Documentation for Easy Library Management System

Field(s) cmbsort optasc optdsc cmdfilter cmdunload Form

Event(s) Click Click Click Click Click Load Unload

Purpose Enable frasort and txtfilter. Sort the data ascending, through frmsearchs Adodc1 with the respect to text displayed in combo-box. Sort the data descending, through frmsearchs Adodc1 with the respect to text displayed in combo-box. Filter the data in the field specified in accordance to the text written in txtfilter. Close the form. Fill the combo-box with the texts specified if the required criteria meet. Enable frmsearch.

Overview of status of Books (frmglance)

Bishwanath Parajuli

160

Documentation for Easy Library Management System

Field(s) chkshow cmbdays lsvbook Form

Purpose Enable cmbdays and call function add if unchecked. Else, disable cmbdays and call function listings. Click Display the books that will/not expire after the days shown in the combos text and change the fore-color of lsvbook into Red, if expired. ColumnClick Sort the items displayed in column of the list view. Load Call the functions required by the form.

Event(s) Click

Functions:
Name of Function add listings Purpose Clear and add item into cmbdays. Clear list view (lsvbook) and add item into it from qryissuerecset.

Bishwanath Parajuli

161

Documentation for Easy Library Management System

Membership Overview (frmovmem):

Field(s) chklist DTPicker lsvmem Form

Purpose Enable DTPicker and clear the list view if unchecked. Else, disable and refresh DTPicker and call function listdatas. Display the memberships that will/not expire after the days Change shown in the DTPicker and change the fore-color of lsvmem into Red, if expired. ColumnClick Sort the items displayed in column of the list view. Load Call the functions required by the form and disable DTPicker.

Event(s) Click

Functions:
Name of Function listdatas Purpose Clear list view (lsvmem) and add item into it from memeberrecset.

Bishwanath Parajuli

162

Documentation for Easy Library Management System

General Overview (frmoverview)

Field(s) cmdok optlevel optwhole cmblevel Form

Event(s) Click Click Click Click Load

Purpose Unload the form. Display fralevel and hide fradet. Display fradet and hide fralevel. Use Adodc3 to calculate the total number of member in the category displayed in the cmblevel. Configure Adodc1, Adodc2, and Adodc3 and use Adodc2 to evaluate the sum of 8th field of tblbookdetails.

Bishwanath Parajuli

163

Documentation for Easy Library Management System

Quick View (frmreminders):

Field(s) lstview Form

Event(s) Purpose ColumnClick Sort the data ascending or descending. Call all the functions required by the form, compare the 5th Load field of qryissue with system date and list those data that are less than the system date.

Bishwanath Parajuli

164

Documentation for Easy Library Management System

History (frmhistory):

Field(s) chkdet lstbooks Form

Event(s) Click Click Load

Purpose Allow view of gridhistory by expanding the form. Display the details of the records in specified labels. Configure adohistory and add item into lstbooks.

Bishwanath Parajuli

165

Documentation for Easy Library Management System

Help File System:

The help file for this program Easy Library Management System Help.hlp was created using Help Workshop. It is summary and e-version of the User Documentation included in the document.

Bishwanath Parajuli

166

Documentation for Easy Library Management System

Modules:
usermodule:
The main function of this module is to Establish a new global ADODB connection named connect and declare ADODB record sets relating to various tables and queries. These record sets are specified in the form of functions usually called in forms (as written above) to make the relation between the data and database (tables and queries are explained above). The list of functions is given below: Name of Function connection bookrecset, memeberrecset, issuerecset, security, author, publisher, reserverecset, finerecset, supplierrecset, preferrecset, booklistrecset, historyrecset qryissuerecset, qryfinerecset

Purpose Sets new record sets and connection and specifies the provid and data source.

Specify the data source to each required record set from the different tables in data source.

Specify the data source to qryissuerecset from qryissue and qryfinerecset from qryfine.

This module also declares a new function, apiCopyFile, used while copying file from one location to another.

Code Listings:
Complete code listing is included in appendix III.

Bishwanath Parajuli

167

Documentation for Easy Library Management System

13.2

User Documenation:
This document has been written to serve the user to know about the interface of Easy Library Management System (ELMS). It is produced in order to help the user to understand the working environment, as this documentation includes all the user interfaces, steps of dealing with the complexities usually faced while working under this fully automated system. The interface has been described and previewed below:

Login Window
This designed unauthorized access of this software. Type the username and password in the relevant fields and click on OK button or hit the enter button for further processing. Visitors can just hit the enter button or press OK button for further processing. window in (fig 1) has been order to prevent

Bishwanath Parajuli

168

Documentation for Easy Library Management System

Mother Window

Fig 2 The mother window (Fig 2) is the main window of this application. It provides a list of interactive menus through which all the tasks related to this application can be carried out.

Bishwanath Parajuli

169

Documentation for Easy Library Management System

Menus and their Function File menu


Context Issues Renew/Return Reservation Exit Description Opens a form for issuing books Opens a form for selection of the basic library tasks, renewing and returning books and charging due books Opens a form to allow reservation of the books Allows terminating program Shortcuts Ctrl + I Ctrl + L Ctrl + R Ctrl + Q

Management menu
Context Book Details Member Details Description Opens a form for adding details about new books, deleting or modifying it Opens a form for adding details about new member, deleting or modifying the old members, etc. Opens a form for adding new publisher and author and deleting the records of publisher and author Opens a form for adding details about supplier and deleting them Shortcuts Ctrl + B Ctrl + M Ctrl + A Ctrl + K

Publisher and Author Details Supplier Details

Bishwanath Parajuli

170

Documentation for Easy Library Management System

Edit menu
Context Search Calculate total Fine View History Request a New book Description Opens a form to allow searching, sorting and filtering data using various search criteria and options Opens a form to calculate the total amount of fine left to be collected, if the user is an administrator Opens a form that allows viewing the past records of issued books Opens a form to list the Books on demand in the library Sub Context Description Opens a form to Issued Books overview issued books Opens a form to Membership overview the membership period Opens a form for over viewing details of library Shortcuts Ctrl + F

Ctrl + H Ctrl + N

Overview

Ctrl + O

General Overview

Settings Menu
Context Description Sub Context Description Backup Allows creating a Database backup of the database Restore Allows restoring the previously made backup Compact and Allows repairing Repair and decreasing the Database size of database Opens a form to add new user, change password, or delete user. Opens a form to customize the function of the application Shortcuts

Database Utilities

Ctrl + S

Security Preference

171

Bishwanath Parajuli

Documentation for Easy Library Management System

Reports Menu
Context Member Report Book Report Fine Report Reservation Report Description Opens a report window that allows printing and exporting details of all the members Opens a report window that allows printing and exporting details of all the books Opens a report window that allows printing and exporting fine details Opens a report window, which allows printing and exporting details of the entire reserved book Opens a report window that allows printing and exporting list of books that have crossed their due date Shortcuts

Due Report

Help Menu
Context Help content About ELMS Description Opens a window that includes help for this program Opens a form that includes a short description of this product Shortcuts F1

Bishwanath Parajuli

172

Documentation for Easy Library Management System

Toolbar and their Functions Context


Go To

Description
Sub Context Description Issue Opens Issues form Renew or Return Opens Renew/Return/Fine form Reserve Opens Reservation form Book Opens Book Details form Member Opens Member Details form Publisher/Author Opens Publisher and Author Details form Supplier Opens Supplier Details form User Details Opens Security form Change User Opens Login window Opens Search window Opens form for sending e-mails

Add New Security Search Mail

Controls for navigation (Navigation buttons)


These controls have been used throughout the application for moving throughout the records. Move to the first Record. Move a record back relative to the current record. Move a record front relative to the current record. Move to the last record.

Direction Key (On Keyboard)


Down Key Up Key Right Key

Bishwanath Parajuli

173

Documentation for Easy Library Management System

Left Key

Bishwanath Parajuli

174

Documentation for Easy Library Management System

Description of the interface Issues form

A preview of interface of Easy Library Management System for issuing the book has been shown above. The process of making book issues has been listed below: Entry Method: Select the book code listed in the drop-down list. Since this system is fully automated, the title of book, its type and date of issue along with its returning date will automatically be seen on the screen. Press [Tab] button to shift focus to borrowers ID or just click on the borrowers ID field. (Note that returning date is according to the book type.) Similarly, select the borrowers ID from the other dropdown list and you will have the details of the member like his full name and his photo will appear in the

Bishwanath Parajuli

175

Documentation for Easy Library Management System

screen. You can also add comment (optional) (Max size = 30) about the borrower, especially regarding his borrowing activities, if you like. Press [Tab] to shift focus to Update button. Press Update button to make an issue. If issue is not made appropriate message will be displayed. If the issue is successful, it shifts the focus again to books code field. Navigating Press Clear button to re-enter the data, after navigation has been completed, to enable the fields.

Bishwanath Parajuli

176

Documentation for Easy Library Management System

Renew/Return form
When you click the Renew/Return menu from the menu bar or toolbar, the user will firstly be taken to the window that is shown below. Click on any of the options and a form will open for the respective task.

Selecting Renew a Book option will open a form given below. On selecting, Return a Book option, this same window will open but Renew button will be replaced with Return button. When the user presses Delete button from keyboard, this window will close down and the window shown above will be loaded again. Preview of Return button is given overleaf:

Bishwanath Parajuli

177

Documentation for Easy Library Management System

Bishwanath Parajuli

178

Documentation for Easy Library Management System

Entry Method: The process of entering data in this form is same as adding data in issue form. The entire borrower ID is populated in the combo box. First, you have to select the borrowers ID from it. All the required information regarding the borrower like his name, contact number and membership expiry date, etc are displayed automatically. Press [Enter] to shift focus on the book code fields. In the same way, select the book code and the required information like, title of the book, issue date of the book and its returning date is displayed automatically. You can also find that if the borrower has issued the book, as Book is not issued will appear in a label. Press [Enter] to shift focus on Renew, Return button. To return to select Renew/Return menu, press [Delete] key. Press Renew, Return button as shown on the screen and respective task will be carried out. If the task is not successful, appropriate message box with reason will be displayed and the buttons will be disabled. In case the borrower has fine to pay, the form expands and the preview of the form will be as shown overleaf. A message box (Page 192, msg 1) will appear showing the total fine amount and asking whether to charge the fine or not. If you want to charge the fine, press Collect Fine button and the book will be ready for issuing again. Bishwanath Parajuli 179

Documentation for Easy Library Management System

(The Administrator/General User is allowed to collect the fine. The fine rate is Rs. 2 per day, until 7 days and Rs. 5 for the extended period as per discussed in the survey.)

Bishwanath Parajuli

180

Documentation for Easy Library Management System

Bishwanath Parajuli

181

Documentation for Easy Library Management System

Reservation form
Easy Library Management System allows reserving the books

with some clicks. Entry Method: Select the book code from the drop-down combo-box. Press [Enter] to shift focus to Member ID drop-down list Select the member ID from the list and the first name of member will automatically appear. Press [Enter] to shift focus to Reserve button Press [Enter] and the reservation will be made. If unsuccessful, appropriate message will be shown with reason. If successful, the focus will shift back to book code list. Bishwanath Parajuli 182

Documentation for Easy Library Management System

To cancel the reservation, press Cancel Reservation after selecting the book code and Member ID.

Output of Data: Reservation form has two grids-for viewing the reserved books and for viewing book details. On pressing the View Reserved Book button, a grid for viewing reserved book is seen which updates in every reservation or cancellation. The other grid, which contains the book details, is displayed by pressing the View Book Details button.

Bishwanath Parajuli

183

Documentation for Easy Library Management System

Book Details form


A preview of interface of ELMS for adding new record of the book (available only for Administrator) is shown below:

Significance: Allows adding record of new book in the database Allows deleting the record of book from the database Allows modifying the record of book present in the database Allows the user to see the records of book directly from grid

Bishwanath Parajuli

184

Documentation for Easy Library Management System

Entry Method: To add a new record, first select Form View tab and press [Enter]. The focus will shift to New Record button Press [Enter] or New Record button to shift focus to enter a book code. A code (Max- length = 5) for the book will automatically appear in the Code text-box. You also can change the auto code of the book and use a preferred code instead of it. Press [Tab] and the focus will shift to Title text-box. Type the title of the book (Max length = 80) and press [Tab] to shift the focus to Edition textbox. Type the edition in the field. The quick load feature of ELMS will automatically set the required closings. For example, type 1 and press [Tab] and the edition will automatically be 1st. Pressing [Tab] will also shift focus to Type of Book field. Select the type of book from the option by using mouse or by using direction keys. Press [Tab] to shift focus to Number of Copies field. Type the number of books (Max length = 2) with the current book title in the library and press [Tab] to shift focus to ISBN Number Fields. Bishwanath Parajuli 185

Documentation for Easy Library Management System

Type the ISBN number of the book (Max length = 13) and press [Tab] to shift focus to Published Year Fields.

Type the year of publication of the book (Max length = 4) and press [Tab] to shift focus to Volume of Book field.

Type the volume of the current book (Max length = 3) and press [Tab] to shift focus to Price of Book field.

Type the price of book (Max length = 5) and press [Tab] to shift focus to Shelf Number field.

Type the number of shelf (Max length = 3) and press [Tab] to shift focus to Save Record button.

Press Save Record and the book will be saved and focus will shift to Code field. Press Clear button to empty all the fields, if needed.

If you do not want to save the record, press Cancel button in order to cancel adding new record.

Navigation The user can use the buttons described above (page 5) for moving through the records. Bishwanath Parajuli Press icon to search records and view them.

186

Documentation for Easy Library Management System

Editing Method: To delete a record, press Delete button. An Input box will appear. Type the book code or Title of the book, to delete. Press [Enter] or OK button in Input box and a message will be displayed asking whether to delete the data. Press, Yes in the message box or [Enter], and the record will be deleted. To modify a data, press Modify button after you have edited the existing record. The entry method is given above. To modify the Book Code, search the data using navigation button or . After the data required editing

appears. Double Click on Book Code field and type the new code. Mean while button

appears. After typing the new code press, Change Code, button a message box will appear asking whether or not you are sure of it. Press Yes or OK and the book code will be changed. Select Tabular View tab to view the data in grid. If you want select the data to edit from there, click on the data you want to edit, and the data will appear in Form View tab. Edit the data where needed and press Modify button to save modifications.

Bishwanath Parajuli

187

Documentation for Easy Library Management System

Bishwanath Parajuli

188

Documentation for Easy Library Management System

Member Details form


The preview of interface of ELMSs member record keeping form (available only for Administrator) is given below:

Significance: Allows the user to keep details of all the necessary information of the members Allows the user to check membership expiry date of every member

Bishwanath Parajuli

189

Documentation for Easy Library Management System

Allows the user to delete, modify and save the records of members Allows the user to print a Library Card Allows the user to View all the data through grid Entry Method: To add a new record, Select Form View tab and press [Enter] to shift focus to Add New Member button. Press [Enter] or Add New Member button and the focus will shift to Member ID field. An auto code (Max length = 5) for the student will appear in the screen. Press [Tab] to shift focus to First Name. The user can also specify it. Type the First Name (Max length = 30) and Press [Tab] to shift the focus to Middle Name (Max length = 30) field. Type the data (optional) in the field and Press [Tab] again to shift the focus Last Name (Max length = 30) and type the last name. Continue the process to shift the focus of cursor to Date

of Birth field. Press on the dropdown menu to select the date. The date is in the format (MM/DD/YYYY). Alternatively, use the direction key to select the date. For example, use Up/Down key to select the month, use Right key to shift focus to day and use Up/Down key to select the day. In the same, way select year.

Bishwanath Parajuli

190

Documentation for Easy Library Management System

Press [Tab] to shift focus to Grade/Category field. Use

Up/Down key to select the grade or category of the borrower. Alternatively, use dropdown menu. Press [Tab] to shift focus to Contact/Mail Address field.

Be careful about the contact number or mail address. Check Validate Contact box if you are entering the phone/fax/cell number (Max length = 13\0). If you are entering other addresses like, G.P.O Box, email address or other means of mailing, uncheck the check box (Max length = 30). (Note: It is mandatory to include . in the Contact/Mail Address field if you are not checking the Validate Contact box. ) Press [Tab] to shift focus to Gender field. Select the

gender using direction key. Click on the frame to insert the picture of the member. A

dialog box will appear allowing you to choose the picture. Select the picture from the desired location and press [Enter] or press Open button. The picture will be seen in the frame. If you want to choose another picture, click on the frame again. The Membership Acquired Date is set automatically to

current system date and Membership Expiry date is set two years front from todays. The symbol, by the side of Membership

Expiry date, denotes that the membership has expired already whereas symbol denotes that the expiry date has not expired

until todays date.

Bishwanath Parajuli

191

Documentation for Easy Library Management System

Press [Tab] to shift focus to Save Member button and

press [Enter] or press Save Member button. The record will be saved and focus will shift back to Members ID field. Press Erase to reset all the fields, if needed. Editing Method: To delete a record, press Delete button. An Input box will appear. Type the Member ID, to delete. Press [Enter] or OK button in Input box and a message will be displayed asking whether to delete the data. Press, Yes in the message box or [Enter], and the record will be deleted. To modify a data, press Modify button after you have edited the existing record. The entry method is given above. Select Grid View tab to view the data in grid. If you want select the data to edit from there, click on the data you want to edit, and the data will appear in Form View tab. Edit the data where needed and press Modify button to save modifications. Record Viewing Methods: Use the Navigation buttons to view and move through the records.

Press

icon to search records and view them.

Bishwanath Parajuli

192

Documentation for Easy Library Management System

Other Functions in the form: Press Issue button to jump to Issues form. Press Renew Membership button, to renew the membership period two years from todays date. This feature is available only, when the membership of the member expires. Press Print a Library Card to jump to Microsoft Word in order to print a library card. This function is activated only while using navigation buttons. The required information of the member, currently displayed in the screen, will be exported to Microsoft word. The preview of the card is shown below:

Bishwanath Parajuli

193

Documentation for Easy Library Management System

Publisher Form

and

Author

Details

A preview of the interface for keeping publishers and authors of the book is shown below:

Entry Method: Select the book code from the drop down list. The title of the book will automatically appear and focus will shift on the tabs. Click on the tabs or select the tabs using direction keys for respective tasks. o Methods for working in Author Details Press New Author button and focus will automatically shift to Author Name field. All other tabs will be invisible.

Bishwanath Parajuli

194

Documentation for Easy Library Management System

Type the author name (Max length = 60) and press [Enter] to shift the focus to Contact field. Type contact (Max length = 100) (optional) and press [Enter] to shift focus to Country field button. Type the authors nationality and press [Enter] to shift focus to Save Author button. Press Save Author button or [Enter] to save record and focus will automatically shift to New Author button. All other tabs will be visible. Press Cancel Saving to cancel saving new record. Press Delete Author button and input box will appear. Type the code or name of the author you want to delete and press [Enter] or OK. The record will be deleted. To modify a record, press Modify after performing the necessary editing.

Bishwanath Parajuli

195

Documentation for Easy Library Management System

o Methods for working in Publisher Details Press New Publisher button and

focus will automatically shift to Publisher Name field. All other tabs will be invisible. Type the publisher name (Max

length = 60) and press [Enter] to shift the focus to Contact field. Type contact (Max length =

100) and press [Tab] to shift focus to Save Publisher button. If you typing the publishers website then write the domain, name and press [Enter]. The quick load feature will automatically add the rest. For e.g. if publishers site is www.abcd.com then just type abcd and press [Enter], the site will automatically change into www.abcd.com. Press Save Publisher button or

[Enter] to save record and focus will automatically shift to New Publisher button. All other tabs will be visible. Press Cancel Saving to cancel saving new record.

Bishwanath Parajuli

196

Documentation for Easy Library Management System

Press Delete Publisher button

and input box will appear. Type the code or name of the publisher you want to delete and press [Enter] or OK. The record will be deleted and a message will be displayed. To modify a record, press

editing.

Modify after performing the necessary

View Data: Press View Authors to view all authors and View Publishers to view all publishers in grids, after selecting View Publishers and Authors tab.

Bishwanath Parajuli

197

Documentation for Easy Library Management System

Supplier Details Form

The preview of interface of ELMSs supplier details form is shown in the left side of the page:

Entry Method: Enter the name (Max length = 80) of the supplier and press [Tab] to shift focus to Address field. Type the address of the supplier (Max length = 80) and press [Tab] to shift focus to Contact field. Type the contact or address (Max length = 40) of the supplier and press [Tab] to shift focus to Save Supplier button. Bishwanath Parajuli 198

Documentation for Easy Library Management System

Press Save Supplier button and the data will be saved. Press Refresh to reset all the fields.

Press Delete button and an input box will appear. Enter the supplier code or name and press [Enter] or OK. The record will be deleted and a message will be displayed.

Other Functions in the form: Press button and Mail form will open. The data in

contact field will automatically be exported to Mail form (Page 40) to enable the user to send e-mail to the supplier. Check View Suppliers box to see all the suppliers and their required details. Use supplier. Press button to search the

button and an input box will

appear. Enter the supplier code or name and press [Enter] or OK. If the record is found it will be displayed in the respective fields.

Bishwanath Parajuli

199

Documentation for Easy Library Management System

Bishwanath Parajuli

200

Documentation for Easy Library Management System

Search Form
Preview of the interface for searching data is shown below:

Entry Method: The focus will automatically be shifted to Issued Books field. Select the Search Criteria using direction key. The Search Details will appear according to the Search Criteria you select. Press [Tab] button to set focus to Search Details By, fields.

Bishwanath Parajuli

201

Documentation for Easy Library Management System

Use the direction key to select the search details. The search field will appear according to the selected search details i.e. while selecting Member ID, What do you want to Search? field is text-box but while selecting Level, the field changes to drop-down box. Press [Tab] to shift focus to this field.

Type the search text, if a textbox appears and select the search type, if combo box appears. Press [Tab] to shift focus to button. button and the searched data will appear, if

Press

existed or appropriate message will be displayed.

Bishwanath Parajuli

202

Documentation for Easy Library Management System

Other Functions in the form: ELMS provides the function of sorting and filtering the data too. Press button (Note: This feature is available

only if you select View All options from Search Details By field) to sort the data and another form will appear in front of the screen allowing you the user to sort and filter the data. The preview of the form is shown below:

Entry Method:

o Press form.

from Search form to display this

o Select the sort option from the drop-down box. This will enable all other fields. Press [Tab] to shift focus to Sort By field. o To sort the data in Search form select sorting option from Sort By field and the data will be sorted accordingly. Press [Tab] to shift focus to Filter field.

Bishwanath Parajuli

203

Documentation for Easy Library Management System

o Type the filtering word for filtering the sort option and Press [Tab] to shift focus to Filter Containing button. o Press Filter Containing button and the data will be filtered in the Search form i.e. if you type filter text S for First Name than all the data starting with S will be displayed.

Calculate total Fine Form


The preview of the interface used for calculating total fine (available only for Administrator) is shown below:

Operating Method:

Bishwanath Parajuli

204

Documentation for Easy Library Management System

This feature is only available for Administrator. Press Collect Fine button and a message-box will appear that will ask whether the fines have been collected or not. Press Yes or [Enter] and all the records will be deleted from the fine record. You can view the total fine in the Total Fine field. To view Details about the fine collected, check View Details box. To calculate the total fine paid by a member, click on Calculate fine for a member button. Enter the borrower ID of the borrower in the inputbox and press OK or [Enter]. The total fine paid will be displayed.

Bishwanath Parajuli

205

Documentation for Easy Library Management System

Request a New book Form


Interface for adding the records of requested book is shown below:

Entry Method: The focus is automatically shifted to Title of Book

(Max length = 80) field. Type the title of book and press [Tab] to shift focus to Queue it Button list. Editing Method: Double Click on the title of book, shown in the list, Press [Enter] or Queue it Button to keep the book in

which you want to delete. A message-box will appear asking, if you want to delete the data. Press Yes or [Enter] to delete the data. Bishwanath Parajuli 206

Documentation for Easy Library Management System

Printing Method: Press button and a report window will appear that consists

the list of the all the requested book. Press on the print icon ( ) from that window and the list will be printed or press button to export the data into another formats. A preview of this Report window is shown below:

Note: Printing method for every report window is the same.

Bishwanath Parajuli

207

Documentation for Easy Library Management System

Overview Forms
The preview of interfaces to check the due books and membership expiry date is shown below: Issued Book: This form allows the user to view the books that have crossed their due date, already. It also allows the user to see the books that will expire after certain days.

Operating Method: Open this form and list of members who have issued books will be shown. Those rows that are highlighted with red color signify the books that have crossed the

Bishwanath Parajuli

208

Documentation for Easy Library Management System

due date. Click on the columns to sort them, if needed.

Check the check box seen in this form to view the books that will probably expire within few days. Press [Tab] to shift focus to Days field.

Select the days, using direction key or drop-down button, to see which books expire in and in between the selected period.

To return to original view uncheck the check box.

To sort the records, click on the column heading, if needed.

Bishwanath Parajuli

209

Documentation for Easy Library Management System

Membership: This form allows the user to view the memberships that have crossed their due date, already. It also allows the user to see, when the membership will expire.

Bishwanath Parajuli

210

Documentation for Easy Library Management System

Operating Method: Open this form and list of members and their membership expiry date will be shown. Those rows that are highlighted with red color signify memberships that have expired already. Click on the to sort them, if needed. Select the check box seen in this form to see when the membership will expire. Press [Tab] to shift focus to Date picker.

Press on the dropdown menu to select the date. The date is in the format

Bishwanath Parajuli

211

Documentation for Easy Library Management System

(MM/DD/YYYY). Alternatively, use the direction key to select the date. For example, use Up/Down key to select the month, use Right key to shift focus to day and use Up/Down key to select the day. In the same, way select year. To return to original view uncheck the check box. To sort the records, click on the column heading, if needed.

Bishwanath Parajuli

212

Documentation for Easy Library Management System

General Overview Form


This form provides overall view of the library at a glance.

Operating Method: Open this form to have a quick view in the total numbers of book, members, issued books and value of library. Press [Tab] to view the number of members linked in various grade or category. Press [Tab] to set focus on the Grade/Category field. Use direction key or mouse to select the grade/category. The number of members in each grade/category will be shown below.

Bishwanath Parajuli

213

Documentation for Easy Library Management System

Press OK to terminate the window.

Bishwanath Parajuli

214

Documentation for Easy Library Management System

History Form:
A preview of interface for viewing history records is given below:

Operating Method: Click on the History Code list box and find the data you want to check. The description of the data will be shown in right side of the form. Check View Details box to view the records in tabular form.

Bishwanath Parajuli

215

Documentation for Easy Library Management System

Database Utilities
ELMS helps to create backup of the database and allows to compact and repair the database too. The user needs to click on simple menus on the mother window and rest will be done automatically. It is recommended that the user create backups and compact the database frequently to prevent loss of data. The preview of menu is shown below.

Click on Backup Database and a dialog box will appear which will allow you to select the path for creating backups. Click on Restore and a dialog box will appear to select the backup you want to use. Click on Compact and Repair Database and the size of the database will be reduced and database will be repaired.

Bishwanath Parajuli

216

Documentation for Easy Library Management System

Bishwanath Parajuli

217

Documentation for Easy Library Management System

Security Form:
ELMS provides 3 different access rights on the basis of user. A preview of interface is shown below:

Entry Method: Select Add New User tab and press [Tab] to set focus on username field. Type the username (Max length = 8) and press [Enter] to set focus on user type field. Select the user type from the drop-down list by using direction keys or mouse click. There are two different user types: - i) Administrator and ii) General User. Select the type and press [Enter] to set focus to password fields.

Bishwanath Parajuli

218

Documentation for Easy Library Management System

Type the password (Max length = 8) in this field. Passwords are denoted by * characters. Press [Enter] to set focus to Confirm Password fields.

Type the same password (Max length = 8), as typed above, in this field and press [Enter] to shift focus to Add New User button.

Press Add New User button and the username will be saved. The cursor moves back to username field. Use button to reset all the fields.

Editing Method: Changing password Select Change Password tab and press [Tab] to set focus on username field. Type the username and press [Enter] to set focus on Old Password fields. Type the old password and press [Enter] to set focus on New Password fields. Type the new password (Max length = 8) and press [Enter] to set focus on Confirm Password fields. Type the new password again and press [Enter] to set focus on Change Password button.

Bishwanath Parajuli

219

Documentation for Easy Library Management System

Press Change Password button and the password will be changed. The cursor moves back to username field. Use fields. button to reset all the

Deleting Username Select Delete User tab and press [Tab] to set focus on username field. Type the username and press [Enter] to set focus on password fields. Type the password and press [Enter] to set focus Delete User field. Press Delete User button and the user will be

deleted. Data in all the fields will be erased and the cursor will move back to username field.

Bishwanath Parajuli

220

Documentation for Easy Library Management System

Preference Form:
ELMS provides the customization feature to the user. The user (Administrator only) can change the options of the application. A preview of this form is given below:

Operating Method: Check Load Quick View for due books, at Startup to automatically load a form showing due books (see page 191) when the application starts. Check Load Quick View for Membership books, at Startup to automatically load Membership form at startup. Check Create backup at termination of this program to automatically create backups. Check Compact and Repair database at termination to automatically compact and repair database. Check Inform me about total fine collected, at startup to show a message box displaying total fines left to be collected.

Bishwanath Parajuli

221

Documentation for Easy Library Management System

Bishwanath Parajuli

222

Documentation for Easy Library Management System

Reports:
Reports are the proof of the regular activities. ELMS allows the user to generate reports on regarding various matters. Use the menus in the mother window to generate report. To print a Report press on report or press icon, found in every

to export the report into other format. page 31. The user

A preview of the report is shown in and dues.

can create reports on members, books, fines, reservations

It is a preview from main menu. Click on any of them and a report will be generated.

Bishwanath Parajuli

223

Documentation for Easy Library Management System

E-Mail:

This form is designed for the purpose of sending mails to the suppliers.

Entry Method: Type the email address in To fields and press [Tab] to shift focus to Subject fields. Type the subject of the mail and press [Tab] to shift focus to main text area of the form. Type the mail and press [Tab] to shift focus to Microsoft Office Outlook.) button. Press

button and the mail will be sent. (Note: It is mandatory to have

Bishwanath Parajuli

224

Documentation for Easy Library Management System

Bishwanath Parajuli

225

Documentation for Easy Library Management System

Reminders Form:

This form is activated only when Load Quick View for due books, at Startup option from Preferences (See page 188) form is selected. This form contains the list of due books.

Bishwanath Parajuli

226

Documentation for Easy Library Management System

Preview of Message boxes used in ELMS:

Fine calculation message (msg 1) message (msg 2)

Code repetition

Renew/Return cancellation message (msg 3) Field left unattended message (msg 4)

Code repetition message (msg 5) Membership expired message (msg 6)

Bishwanath Parajuli

227

Documentation for Easy Library Management System

Sorting failed message (msg 7) confirmation message (msg 8)

Delete

Book available message (msg 9) issued message (msg 10)

Book already

Glossary: Combo box = Drop down list box Check box = box that contain right sign when clicked. List box = box containing list of data Form = window/interface Label = an area for displaying text. Field = text area Input box = a box for entering required value. Grid = table containing records. Date Picker = a drop down list that is used to select date. Auto number/code = number/code that automatically increases in its value. ELMS = Easy Library Management System.

Bishwanath Parajuli

228

Documentation for Easy Library Management System

13.2.1 Guide for Installing/Uninstalling the product:


Installing the Product:
To install the software, click on setup.exe. A screen as shown below appears. Click OK button and the installation starts.

A dialog box as shown below appears on clicking. Click on the installation icon to begin installation or to change the location for keeping the installed components press Change Directory button.

Bishwanath Parajuli

229

Documentation for Easy Library Management System

After that, another dialog box as shown below appears.

Press Continue or type the name that you want to indicate the program to appear in the start menu. A box as shown below appears when installation begins.

Bishwanath Parajuli

230

Documentation for Easy Library Management System

When the installation ends, a box as shown below appears which indicates the installation is over.

In this way the installation of the software is done.

Bishwanath Parajuli

231

Documentation for Easy Library Management System

Uninstalling the product:


Click on icon of Easy Library Management System visible in Add or Remove Programs. A screen as shown below appears.

Click on Yes to remove the application from computer. After a while, another message box appears as shown below:

This message box signifies the removal process has completed. Press OK to return to Add or Remove Programs window. Note: Click on Control Panel menu available at the Start menu available in Windows XP to select Add or Remove Programs option.

Bishwanath Parajuli

232

Documentation for Easy Library Management System

Index For User Documentation:


B
Book Details form........................184 Book Entry...................................185 Publisher and Author Details Form ................................................194 Publisher/Author Entry................194

C
Calculate total Fine Form............204 Changing Password.....................219 Controls for navigation................173 Creating new user........................218

Q
Quickly Loading publisher's site. 196

R
Renew/Return Entry....................179 Renew/Return form.....................177 Renewing Membership................193 Report Printing Method...............207 Reports Generation......................223 Reports Menu...............................172 Request a New book Form..........206 Requesting new book...................206 Reservation Entry........................182 Reservation form.........................182

D
Database Utilities.........................216 Deleting Book request.................206 Deleting Username......................220 Direction Key (On Keyboard).....173

E
Edit menu.....................................171

F
File menu.....................................170 Filtering Data...............................204 Fine Collection.............................204

S
Search Entry.................................201 Search Form.................................201 Security Form..............................218 Settings Menu..............................171 Significance of Book Details Form ................................................184 Significance of Memeber Details Form.......................................189 Sorting Data.................................203 Supplier Details Form..................198 Supplier Entry..............................198

G
General Overview Form..............213 Glossary.......................................228 Guide for Installing/Uninstalling the product....................................229

H
Help Menu...................................172 History Form................................215

I
Installing the Product...................229 Issue Entry...................................175 Issued Book.................................208 Issues form...................................175

T
to loading member status at startupLoad Quick View for Membership............................221 Toolbar and their Functions.........173

L
Load Due Books at startup..........221 Login Window.............................168

U
Uninstalling the product..............232

V
View Due Books..........................226 Viewing Issued Books.................208 Viewing Membership..................211

M
Mailing.........................................224 Management menu.......................170 Member Details form...................189 Member Entry..............................190 Membership.................................210 Menus and their Function............170 Mother Window...........................169

N
Navigation buttons.......................173

O
Overall view of Library...............213 Overview Forms..........................208

P
Preference Form...........................221 Preview of Message boxes used in ELMS.....................................227 Printing a Library Card................193

Bishwanath Parajuli

233

Documentation for Easy Library Management System

Appendix I
I)
SA:

Interview with Mr. Acharya:


What are the major problems you are facing in

the current system? Mr. Acharya: The system is very boring to work with. Besides, there are no particular records of any students or books and searching the records of issue is very time consuming. In addition, sometimes a student issues more than single book or issues the same book twice. SA: So, what do you expect to be in the new system?

Mr. Acharya: It must be able to hold all the information required in the library. I mean, it must be able to hold the information of books, members, publishers and authors and all other activities or materials related with library. SA: Being specific, what information should it hold on about the books? Mr. Acharya: It must be able to hold the title of book, its ISBN, edition, shelf number, price and number of books. Besides, it must be able to generate auto code for every book and it must be possible to modify the code if needed. Bishwanath Parajuli 234

Documentation for Easy Library Management System

SA:

Moving to members, what do you look ahead to about the members?

Mr. Acharya: The new system must hold information like member name, the grade or category, contact number and most necessarily, the membership expiration date. The member also needs to have a unique member id that is automatically assigned. SA: What about issue?

Mr. Acharya: This system must be able to make issues quickly, by selecting the book code and the member id. SA: Do not you think that just entering the book code and member id can bring errors in some cases? Mr. Acharya: In that case, it would be easier if the system will show the details of the books and the members. It also must check if the student has already issued three books or issued the same book. Besides, the system must restrict issuing a reference book or issuing a book to a borrower that has fine to pay. The member whose membership has expired shouldnt be able to make issues. SA: Bishwanath Parajuli And the reservations? 235

Documentation for Easy Library Management System

Mr. Acharya: It must be able to reserve, of course. It also must notify if the book is available in the library. The rest of the features must be similar to that of issue. SA: How do you renew/return the books?

Mr. Acharya: I just mark the records to signify, either of the activities. SA: And, how do you think it must operate in the new system? Mr. Acharya: According to me, the user must be able to select the borrower id and book code so that the system could process the data and carry out the acts. The user must be able to see if the book is really issued and if issued has the book crossed its due date. If the book has crossed the due date, it must be able to calculate fine for that particular borrower. SA: At what rate, do you think, the new system should charge the fines? Mr. Acharya: I think Rs. 2 for a week and Rs. 5 for rest of the time will be appropriate since I am using the same rate in the old system. SA: How do you think the searching must be?

Bishwanath Parajuli

236

Documentation for Easy Library Management System

Mr. Acharya: Searching must be very easier. Just some clicks and types should show the required data. Series of options should guide the user to required data. SA: What about sorting and filtering?

Mr. Acharya: Of course, the system must sort the data because sorting is very useful in searching the data. And, filtering is the best option because, in case, if the whole name is unknown, for example, filtering can easily search the data. Therefore, sorting and filtering are both necessary. SA: What else do you expect to be in the new system?

Mr. Acharya: Well, it must have access rights. Only authorized user should be able to enter the system and the system must be able to hold the list of books that are requested to be brought in the library. And, there must be provision of collecting and calculating fine. And, the user must be able to view if the details of the issue and membership status. It would better to have provision of book history for future referencing,

Bishwanath Parajuli

237

Documentation for Easy Library Management System

SA:

What sort of access rights, do you think, will be suitable?

Mr. Acharya: Well, the system must have access rights divided by the head librarian. There must be a single, head librarian for maintaining the records of members or visitors. There must be a provision for general user who can work in absence of head librarian. There must be provision for adding new user or deleting them. There should be provision for changing the password for smooth administration. SA: And the back up? What about it?

Mr. Acharya: It must have the feature of backing up the data. And, if the data can be compacted too, it would be more efficient. SA: What measure do you prefer for output of data?

Mr. Acharya: Whatever be the measure, the user must be able to generate and print the reports of members, books, reservations and due books. Moreover, the user should be able to print the list of requested books too. SA: Thank you, Mr. Acharya, for your valuable suggestions and time. I will try my best to base the new system upon your suggestions. Bishwanath Parajuli 238

Documentation for Easy Library Management System

Bishwanath Parajuli

239

Documentation for Easy Library Management System

II) Preview of registers, membership card and book card:

Book Card

Membership Card
Bishwanath Parajuli 240

Documentation for Easy Library Management System

Appendix II: Evidence of Testing

Bishwanath Parajuli

241

Documentation for Easy Library Management System

6.1

6.2

6.3

10

Bishwanath Parajuli

242

Documentation for Easy Library Management System

11

12

13

14

15

16
Bishwanath Parajuli 243

Documentation for Easy Library Management System

17

18

19

20

21

22
Bishwanath Parajuli 244

Documentation for Easy Library Management System

23

24

25

Bishwanath Parajuli

245

Documentation for Easy Library Management System

26

27

28

29

Bishwanath Parajuli

246

Documentation for Easy Library Management System

30

31

32

33

Bishwanath Parajuli

247

Documentation for Easy Library Management System

34

35

36
Bishwanath Parajuli 248

Documentation for Easy Library Management System

37

38

39.1

Bishwanath Parajuli

249

Documentation for Easy Library Management System

39.2

40

Bishwanath Parajuli

250

Documentation for Easy Library Management System

41

42

Bishwanath Parajuli

251

Documentation for Easy Library Management System

43

44

45

46

Bishwanath Parajuli

252

Documentation for Easy Library Management System

47

48

49

50

Bishwanath Parajuli

253

Documentation for Easy Library Management System

51

52

53

54
Bishwanath Parajuli 254

Documentation for Easy Library Management System

55

56

57

58

Bishwanath Parajuli

255

Documentation for Easy Library Management System

59

60

Bishwanath Parajuli

256

Documentation for Easy Library Management System

61

62
Bishwanath Parajuli 257

Documentation for Easy Library Management System

63

64

65

66
Bishwanath Parajuli 258

Documentation for Easy Library Management System

67

68

69

70
Bishwanath Parajuli 259

Documentation for Easy Library Management System

71

72

73

74

Bishwanath Parajuli

260

Documentation for Easy Library Management System

75

76

77

78

Bishwanath Parajuli

261

Documentation for Easy Library Management System

79

80

81

Bishwanath Parajuli

262

Documentation for Easy Library Management System

82

83

84

Bishwanath Parajuli

263

Documentation for Easy Library Management System

85

86

87

Bishwanath Parajuli

264

Documentation for Easy Library Management System

88

89

Bishwanath Parajuli

265

Documentation for Easy Library Management System

90

91

Bishwanath Parajuli

266

Documentation for Easy Library Management System

92

93

94

95

96

Bishwanath Parajuli

267

Documentation for Easy Library Management System

97

98

99

100

101

102
Bishwanath Parajuli 268

Documentation for Easy Library Management System

103

104

105

106

Bishwanath Parajuli

269

Documentation for Easy Library Management System

107

108

109

110

Bishwanath Parajuli

270

Documentation for Easy Library Management System

111

112

113

114

Bishwanath Parajuli

271

Documentation for Easy Library Management System

115

116

117

118

Bishwanath Parajuli

272

Documentation for Easy Library Management System

(Note: All the reports are designed in a format similar to that of above.)

Bishwanath Parajuli

273

Documentation for Easy Library Management System

119

Bishwanath Parajuli

274

Documentation for Easy Library Management System

Appendix III: Complete Code Listings


frmAbout: Option Explicit ' Reg Key Security Options... Const READ_CONTROL = &H20000 Const KEY_QUERY_VALUE = &H1 Const KEY_SET_VALUE = &H2 Const KEY_CREATE_SUB_KEY = &H4 Const KEY_ENUMERATE_SUB_KEYS = &H8 Const KEY_NOTIFY = &H10 Const KEY_CREATE_LINK = &H20 Const KEY_ALL_ACCESS = KEY_QUERY_VALUE + KEY_SET_VALUE + _ KEY_CREATE_SUB_KEY + KEY_ENUMERATE_SUB_KEYS + _ KEY_NOTIFY + KEY_CREATE_LINK + READ_CONTROL ' Reg Key ROOT Types... Const HKEY_LOCAL_MACHINE = &H80000002 Const ERROR_SUCCESS = 0 Const REG_SZ = 1 ' Unicode nul terminated string Const REG_DWORD = 4 ' 32-bit number Const gREGKEYSYSINFOLOC = "SOFTWARE\Microsoft\Shared Tools Location" Const gREGVALSYSINFOLOC = "MSINFO" Const gREGKEYSYSINFO = "SOFTWARE\Microsoft\Shared Tools\MSINFO" Const gREGVALSYSINFO = "PATH" Private Declare Function RegOpenKeyEx Lib "advapi32" Alias "RegOpenKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, ByVal samDesired As Long, ByRef phkResult As Long) As Long Private Declare Function RegQueryValueEx Lib "advapi32" Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, ByRef lpType As Long, ByVal lpData As String, ByRef lpcbData As Long) As Long Private Declare Function RegCloseKey Lib "advapi32" (ByVal hKey As Long) As Long Bishwanath Parajuli 275

Documentation for Easy Library Management System

Private Sub cmdSysInfo_Click() Call StartSysInfo End Sub Private Sub cmdok_Click() Unload Me End Sub Public Sub StartSysInfo() On Error GoTo SysInfoErr Dim rc As Long Dim SysInfoPath As String ' Try To Get System Info Program Path\Name From Registry... If GetKeyValue(HKEY_LOCAL_MACHINE, gREGKEYSYSINFO, gREGVALSYSINFO, SysInfoPath) Then ' Try To Get System Info Program Path Only From Registry... ElseIf GetKeyValue(HKEY_LOCAL_MACHINE, gREGKEYSYSINFOLOC, gREGVALSYSINFOLOC, SysInfoPath) Then ' Validate Existance Of Known 32 Bit File Version If (Dir(SysInfoPath & "\MSINFO32.EXE") <> "") Then SysInfoPath = SysInfoPath & "\MSINFO32.EXE" ' Error - File Can Not Be Found... Else GoTo SysInfoErr End If ' Error - Registry Entry Can Not Be Found... Else GoTo SysInfoErr End If Call Shell(SysInfoPath, vbNormalFocus) Exit Sub SysInfoErr: MsgBox "System Information Is Unavailable At This Time", vbOKOnly End Sub Bishwanath Parajuli 276

Documentation for Easy Library Management System

Public Function GetKeyValue(KeyRoot As Long, KeyName As String, SubKeyRef As String, ByRef KeyVal As String) As Boolean Dim i As Long ' Loop Counter Dim rc As Long ' Return Code Dim hKey As Long ' Handle To An Open Registry Key Dim hDepth As Long ' Dim KeyValType As Long ' Data Type Of A Registry Key Dim tmpVal As String ' Tempory Storage For A Registry Key Value Dim KeyValSize As Long ' Size Of Registry Key Variable '-----------------------------------------------------------' Open RegKey Under KeyRoot {HKEY_LOCAL_MACHINE...} '-----------------------------------------------------------rc = RegOpenKeyEx(KeyRoot, KeyName, 0, KEY_ALL_ACCESS, hKey) ' Open Registry Key If (rc <> ERROR_SUCCESS) Then GoTo GetKeyError ' Handle Error... tmpVal = String$(1024, 0) Variable Space KeyValSize = 1024 Size ' Allocate ' Mark Variable

'-----------------------------------------------------------' Retrieve Registry Key Value... '-----------------------------------------------------------rc = RegQueryValueEx(hKey, SubKeyRef, 0, _ KeyValType, tmpVal, KeyValSize) ' Get/Create Key Value If (rc <> ERROR_SUCCESS) Then GoTo GetKeyError ' Handle Errors If (Asc(Mid(tmpVal, KeyValSize, 1)) = 0) Then ' Win95 Adds Null Terminated String... tmpVal = Left(tmpVal, KeyValSize - 1) ' Null Found, Extract From String Else ' WinNT Does NOT Null Terminate String... Bishwanath Parajuli 277

Documentation for Easy Library Management System

tmpVal = Left(tmpVal, KeyValSize) ' Null Not Found, Extract String Only End If '-----------------------------------------------------------' Determine Key Value Type For Conversion... '-----------------------------------------------------------Select Case KeyValType ' Search Data Types... Case REG_SZ ' String Registry Key Data Type KeyVal = tmpVal ' Copy String Value Case REG_DWORD ' Double Word Registry Key Data Type For i = Len(tmpVal) To 1 Step -1 ' Convert Each Bit KeyVal = KeyVal + Hex(Asc(Mid(tmpVal, i, 1))) ' Build Value Char. By Char. Next KeyVal = Format$("&h" + KeyVal) ' Convert Double Word To String End Select GetKeyValue = True Success rc = RegCloseKey(hKey) Registry Key Exit Function ' Return ' Close ' Exit

GetKeyError: ' Cleanup After An Error Has Occured... KeyVal = "" ' Set Return Val To Empty String GetKeyValue = False ' Return Failure rc = RegCloseKey(hKey) ' Close Registry Key End Function

Bishwanath Parajuli

278

Documentation for Easy Library Management System

frmbookdet: Option Explicit Dim checkb As Boolean 'declare variable Private Sub cmdaddnew_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then 'if enter is pressed txtcode.SetFocus 'shift focus End If End Sub Private Sub cmdcancel_Click() 'This procedures deletes the space for adding new data precord.CancelUpdate 'cancel update Call enablecontrols 'call functions Call checkrecords Call clear End Sub Private Sub cmdchange_Click() 'This prcedure is used to change the key field of tblbookdetails On Error GoTo errhandle: If MsgBox("Are you sure you want change the code?", vbQuestion + vbYesNo, "Change...") = vbYes Then If precord.RecordCount <> 0 Then 'if is not the value of precord nothing then precord.MoveFirst 'move recordpointer to first record While Not precord.EOF 'until the end of file continue the process: If precord.Fields(1) = txttitle.Text Then 'compare the value precord.Fields(0) = txtcode.Text 'set the value precord.Update 'update the record and continue with: MsgBox "Book Code updated successfully.", vbInformation, "Change" txtcode.Locked = True fracontrols.Enabled = True franavigate.Enabled = True cmdclear.Enabled = True txttitle.Enabled = True cmdchange.Visible = False End If precord.MoveNext 'move to next record Wend 'repeat Bishwanath Parajuli 279

Documentation for Easy Library Management System

End If Else txtcode.Locked = True 'lock controls fracontrols.Enabled = True 'enable controls franavigate.Enabled = True cmdclear.Enabled = True txttitle.Enabled = True cmdchange.Visible = False 'hide command button End If Exit Sub errhandle: MsgBox Err.Description, vbCritical, "Error" End Sub Private Sub cmdmodify_Click() 'This procedure is used to change the data 'in the fields of tblbookdetails On Error GoTo errhandle: If precord.RecordCount <> 0 Then 'if the recordset is not empty If MsgBox("Are you sure you want to modify the record?", vbYesNo, "Modify?") = vbYes Then precord.MoveFirst 'move to first record While Not precord.EOF 'repeat until the end of file If precord.Fields(0) = txtcode.Text Then 'compare the value and if the value matches 'set the data into record fields precord.Fields(1) = txttitle precord.Fields(2) = txtedition If optfiction.Value = True Then precord.Fields(3) = "Fiction" ElseIf optnonfiction.Value = True Then precord.Fields(3) = "Non Fiction" ElseIf optperiodical.Value = True Then precord.Fields(3) = "Periodical" ElseIf optreference.Value = True Then precord.Fields(3) = "Reference" End If precord.Fields(4) = txtcopies precord.Fields(5) = txtdatep precord.Fields(6) = txtisbn precord.Fields(7) = txtvolume precord.Fields(8) = txtprice precord.Fields(9) = txtsno precord.Fields(10) = txtpages precord.Update 'save the record Bishwanath Parajuli 280

Documentation for Easy Library Management System

MsgBox "Modification saved sucessfully.", vbInformation, "Modification" End If precord.MoveNext 'move to the next record Wend 'repeat End If End If Exit Sub errhandle: MsgBox Err.Description, vbCritical, "Error" End Sub Private Sub cmdsearch_Click() 'This procedure searches for the record Dim vali As String 'declare variable vali = InputBox("Enter the ID or Title of the book you want to find.", "Find") 'allow to input data through an input box If precord.RecordCount <> 0 Then 'if the recordset is not empty precord.MoveFirst 'move the record position to first record While Not precord.EOF 'until the end of the file If precord.Fields(0) = vali Or precord.Fields(1) = vali Then 'compare the field value with find and if matched Call display 'call function Exit Sub 'exit End If precord.MoveNext 'move to next record Wend 'repeat the process MsgBox "Record not found.", vbInformation, "Search" End If End Sub Private Sub bookgrid_Click() 'This procedure sets the data from particular column of datagrid 'to the specified columns If adobook.Recordset.RecordCount <> 0 Then 'set the data into form field from column of datagrid Me.txtcode = bookgrid.Columns(0) Me.txttitle = bookgrid.Columns(1) Me.txtedition = bookgrid.Columns(2) If bookgrid.Columns(3) = "Fiction" Then Me.optfiction.Value = True ElseIf bookgrid.Columns(3) = "Non Fiction" Then Bishwanath Parajuli 281

Documentation for Easy Library Management System

Me.optnonfiction.Value = True ElseIf bookgrid.Columns(3) = "Periodical" Then Me.optperiodical.Value = True ElseIf bookgrid.Columns(3) = "Reference" Then Me.optreference.Value = True End If Me.txtcopies = bookgrid.Columns(4) Me.txtdatep = bookgrid.Columns(5) Me.txtisbn = bookgrid.Columns(6) Me.txtvolume = bookgrid.Columns(7) Me.txtprice = bookgrid.Columns(8) Me.txtsno = bookgrid.Columns(9) txtpages = bookgrid.Columns(10) tabs.TabVisible(1) = False 'hide tab tabs.TabVisible(1) = True 'show tab End If End Sub Private Sub Form_Load() 'This procedure configures ADODC and ADODB controls Call connection 'call function Call bookrecset adobook.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data source = " & App.Path & "\Library Management System.mdb" 'configure provider and application path adobook.CommandType = adCmdUnknown adobook.RecordSource = "select * from tblbookdetails" 'specify the recordsource adobook.Refresh 'refresh adodc Call enablecontrols 'call function Call checkrecords End Sub Sub display() 'This procedure assigns the value to form field 'from corresponding value in record field txtcode = precord.Fields(0) txttitle = precord.Fields(1) txtedition = precord.Fields(2) If precord.Fields(3) = "Fiction" Then optfiction.Value = True ElseIf precord.Fields(3) = "Non Fiction" Then optnonfiction.Value = True ElseIf precord.Fields(3) = "Periodical" Then optperiodical.Value = True Bishwanath Parajuli 282

Documentation for Easy Library Management System

ElseIf precord.Fields(3) = "Reference" Then optreference.Value = True End If txtcopies = precord.Fields(4) txtdatep = precord.Fields(5) txtisbn = precord.Fields(6) txtvolume = precord.Fields(7) txtprice = "$ " & precord.Fields(8) txtsno = precord.Fields(9) txtpages = precord.Fields(10) lblrecordnumber.Caption = precord.AbsolutePosition & " Of " & precord.RecordCount & " Records" End Sub Private Sub cmdaddnew_Click() 'This procedure creates a space for adding new record Dim code As Long 'declare variable Call disablecontrols 'call functions Call clear If precord.RecordCount = 0 Then 'if the recordset is empty code = 101 'specify code = 101 Else precord.MoveLast 'move the pointer to last record code = precord.Fields(0) + 1 'increase the value of code by 1 compared to last record End If precord.AddNew 'ADD NEW RECORD txtcode.Text = code 'set code into textbox End Sub Private Sub cmdsave_Click() 'This procedure saves the data in the database If (optfiction.Value = False And optnonfiction.Value = False And optperiodical.Value = False And optreference.Value = False) Then 'if the options button specified above are unselected MsgBox "Please Select the Category of Book", vbInformation, "Information" Exit Sub 'exit End If checkb = False 'set the value of the boolean to false checkb = checkblanks() 'extract the value of the boolean from function(checkblanks) Bishwanath Parajuli 283

Documentation for Easy Library Management System

If checkb = False Then 'if the function returns with the value false 'set the data in the particular fields of record precord.Fields(0) = txtcode precord.Fields(1) = txttitle precord.Fields(2) = txtedition If optfiction.Value = True Then precord.Fields(3) = "Fiction" ElseIf optnonfiction.Value = True Then precord.Fields(3) = "Non Fiction" ElseIf optperiodical.Value = True Then precord.Fields(3) = "Periodical" ElseIf optreference.Value = True Then precord.Fields(3) = "Reference" End If precord.Fields(4) = txtcopies precord.Fields(5) = txtdatep precord.Fields(6) = txtisbn precord.Fields(7) = txtvolume precord.Fields(8) = Val(txtprice) precord.Fields(9) = Val(txtsno) precord.Fields(10) = Val(txtpages) MsgBox "Record Saved Successfully.", vbInformation, "Information" txtcode.SetFocus precord.Update 'save the record booktimer.Enabled = True 'enable timer Call enablecontrols 'call function End If End Sub Private Sub cmddelete_Click() 'This procedure deletes a record form the database On Error GoTo errhandler: Dim code As String 'declare variable code = InputBox("Enter the Book ID or Title of the Book, you want to delete.", "Delete") 'allow to enter book code through input box If code = "" Then 'if input box not empty MsgBox "Select the item to delete", vbInformation, "Error" Exit Sub 'exit ElseIf precord.RecordCount <> 0 Then 'if the recordset is not empty precord.MoveFirst 'move to first record While Not precord.EOF 'until eof Bishwanath Parajuli 284

Documentation for Easy Library Management System

If precord.Fields(0) = code Or precord.Fields(1) = code Then 'compare the value of code with record field 'if matched If MsgBox("Are you sure you want to delete the record?", vbYesNo + vbQuestion, "Delete") = vbYes Then precord.Delete 'delete record booktimer.Enabled = True 'enable timer Call clear 'call functions MsgBox "Record Deleted.", vbInformation, "Information" Call checkrecords precord.Close 'close the recordset precord.Open 'open the recordset End If End If If precord.RecordCount <> 0 Or precord.EOF = False Or precord.BOF = False Then 'if the record set is not empty 'or record pointer is not at eof or bof precord.MoveNext 'move to next record Call display End If Wend 'repeat End If Exit Sub errhandler: MsgBox Err.Description, vbCritical, "Error" End Sub Private Sub cmdbegin_Click() 'This procedure moves pointer to first record If precord.BOF = True Then 'if recordpointer is at bof MsgBox "This is First record.", vbOKOnly, "Information" precord.MoveFirst 'set the pointer to first record Exit Sub 'exit Else precord.MoveFirst 'move the pointer to first record Call display 'call function End If End Sub Private Sub cmdprevious_Click() 'This procedure moves pointer to relative previous record If precord.AbsolutePosition = adPosEOF Then Bishwanath Parajuli 285

Documentation for Easy Library Management System

'if record pointer is at eof precord.MoveFirst 'move the pointer to first record Exit Sub 'exit ElseIf precord.BOF = True Then 'if record pointer is at bof MsgBox "This is First record.", vbOKOnly, "Information" precord.MoveFirst 'move the pointer to first record Exit Sub Else Call display 'call function precord.MovePrevious 'move backwards End If End Sub Private Sub cmdnext_Click() 'This procedure moves pointer to relative next record If precord.AbsolutePosition = adPosBOF Then 'if recordpointer is at bof precord.MoveLast 'move the pointer to last record Exit Sub 'exit sub ElseIf precord.EOF = True Then 'if recordpointer is at eof MsgBox "This is Last record", vbOKOnly, "Information" precord.MoveLast 'move the pointer to last record Exit Sub Else Call display 'call function precord.MoveNext 'move pointer forward End If End Sub Private Sub cmdlast_Click() 'This procedure moves pointer to last record If precord.EOF = True Then 'if record pointer is at eof MsgBox "This is Last record", vbOKOnly, "Registration" precord.MoveLast 'move to last record Exit Sub 'exit Else precord.MoveLast 'move to last record Call display 'call function End If End Sub Sub clear() Bishwanath Parajuli 286

Documentation for Easy Library Management System

'This procedure is used to reset the data in the fields txtcode = "" txttitle = "" txtedition = "" optfiction.Value = False optnonfiction.Value = False optperiodical.Value = False optreference.Value = False txtcopies = "" txtdatep = "" txtisbn = "" txtvolume = "" txtprice = "" txtsno = "" txtpages = "" End Sub Private Sub Form_Unload(Cancel As Integer) Unload frmissue 'unload form End Sub Private Sub booktimer_Timer() 'This procedure is used to refresh the datagrid bookgrid.Refresh 'refresh grid adobook.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data source = " & App.Path & "\Library Management System.mdb" 'configure provider and data source adobook.CommandType = adCmdUnknown 'specify the record source adobook.RecordSource = "select * from tblbookdetails" adobook.Refresh 'refresh adodc bookgrid.Refresh 'refresh grid booktimer.Enabled = False 'disable timer End Sub Private Sub tabs_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then 'if enter is pressed If tabs.Caption = "Form View" Then 'if tab caption is Form View Me.cmdaddnew.SetFocus 'shift focus End If End If End Sub Private Sub txtcode_Change() Bishwanath Parajuli 287

Documentation for Easy Library Management System

If txtcode.Text = "" Then 'if the textbox is empty cmdchange.Visible = False 'hide button End If If txtcode.Text <> "" Then 'if the textbox is not empty txtcode.Locked = False 'lock textbox End If End Sub Private Sub txtcode_DblClick() If txtcode.Text <> "" Then 'if the textbox is not empty cmdchange.Visible = True 'show the button fracontrols.Enabled = False 'disable controls franavigate.Enabled = False Me.cmdclear.Enabled = False txttitle.Enabled = False End If End Sub Private Sub txtcode_KeyPress(KeyAscii As Integer) 'accept those keypresses which are numeric and backspaces only If Not ((KeyAscii >= 48 And KeyAscii <= 57) Or KeyAscii = 8) Then KeyAscii = 0 End If End Sub Private Sub txtedition_LostFocus() 'This procedure sets character in the field 'according to the condition satisfied Dim last As String 'declare variable If txtedition <> "" Then 'if the textbox is not empty last = Mid(txtedition, Len(txtedition), Len(txtedition)) 'extract the last letter from the text area Select Case last Case 1 'if the last character is as specified txtedition = txtedition & "st" 'set the value, adding some characters, to textbox Case 2 txtedition = txtedition & "nd" Case 3 Bishwanath Parajuli 288

Documentation for Easy Library Management System

txtedition = txtedition & "rd" Case Is < 9 txtedition = txtedition & "th" Case Else txtedition = txtedition End Select End If End Sub Private Sub txtpages_KeyPress(KeyAscii As Integer) 'accept those keypresses which are numeric and backspaces only If Not ((KeyAscii >= 48 And KeyAscii <= 57) Or KeyAscii = 8) Then KeyAscii = 0 End If End Sub Private Sub txttitle_LostFocus() 'This procedure checks for repetition of the book code If Me.cmdaddnew.Enabled = False Then 'if the button is disabled If precord.RecordCount <> 0 Then 'if the recordset is not empty precord.CancelUpdate 'cancel update precord.MoveFirst 'move pointer to first record While Not precord.EOF 'continue until the end of file If precord.Fields(0) = txtcode Or precord.Fields(1) = txttitle.Text Then 'check the field's value with the textbox's 'if data in textbox and record field matches Call display 'call function cmdsave.Enabled = False 'disable button MsgBox "This book exists in the database.", vbInformation, "Book Details" Exit Sub 'exit Else cmdsave.Enabled = True 'enable button End If precord.MoveNext 'move the pointer to next close record Wend 'repeat this process precord.AddNew 'add new record End If End If End Sub Private Sub txtdatep_KeyPress(KeyAscii As Integer) Bishwanath Parajuli 289

Documentation for Easy Library Management System

'accept those keypresses which are numeric and backspaces only If Not ((KeyAscii >= 48 And KeyAscii <= 57) Or KeyAscii = 8) Then KeyAscii = 0 End If End Sub Private Sub txtcopies_KeyPress(KeyAscii As Integer) 'accept those keypresses which are numeric and backspaces only If Not ((KeyAscii >= 48 And KeyAscii <= 57) Or KeyAscii = 8) Then KeyAscii = 0 End If End Sub Private Sub txtprice_KeyPress(KeyAscii As Integer) 'accept those keypresses which are numeric and backspaces only If Not ((KeyAscii >= 48 And KeyAscii <= 57) Or KeyAscii = 8) Then KeyAscii = 0 End If End Sub Private Sub txtsno_KeyPress(KeyAscii As Integer) 'accept those keypresses which are numeric and backspaces only If Not ((KeyAscii >= 48 And KeyAscii <= 57) Or KeyAscii = 8) Then KeyAscii = 0 End If End Sub Private Sub txtvolume_KeyPress(KeyAscii As Integer) 'accept those keypresses which are numeric and backspaces only If Not ((KeyAscii >= 48 And KeyAscii <= 57) Or KeyAscii = 8) Then KeyAscii = 0 End If End Sub Private Sub cmdclear_Click() Call clear 'call function Bishwanath Parajuli 290

Documentation for Easy Library Management System

End Sub Function checkblanks() As Boolean 'check for any fields left unattended Dim Control As Object 'declare variable For Each Control In frmbookdet 'for every such variables in the form If TypeOf Control Is TextBox Then 'if the variable is text box If Control.Text = "" Then 'if any textbox is empty checkblanks = True 'specify the value of boolean as true MsgBox "Please fill all the fields.", vbInformation, "Book Details" Control.SetFocus 'shift focus to that control End If Exit Function 'exit End If Next End Function Sub checkrecords() 'This procedure enable/disables the navigation buttons If precord.RecordCount = 0 Then 'if the record set is empty Me.franavigate.Enabled = False 'disable the frame ElseIf precord.RecordCount <> 0 Then 'if the record set is not empty Me.franavigate.Enabled = True 'enable the frame End If End Sub Sub enablecontrols() 'This procedure enables the conrols specified below Me.franavigate.Enabled = True 'enable controls Me.cmdclear.Enabled = True cmdaddnew.Enabled = True cmddelete.Enabled = True cmdmodify.Enabled = True cmdsave.Enabled = False 'disable controls cmdcancel.Enabled = False End Sub

Bishwanath Parajuli

291

Documentation for Easy Library Management System

Sub disablecontrols() 'This procedure disables the conrols specified below Me.franavigate.Enabled = False 'disable controls Me.cmdclear.Enabled = False cmdaddnew.Enabled = False cmddelete.Enabled = False cmdmodify.Enabled = False cmdsave.Enabled = True 'enable controls cmdcancel.Enabled = True End Sub

Bishwanath Parajuli

292

Documentation for Easy Library Management System

frmbooklist: Private Sub cmdorder_Click() 'This procedure saves the data in the database If txtnew.Text = "" Then: MsgBox "Enter a Book you want to order.", vbExclamation, "Error": Exit Sub nrecord.AddNew 'add new record 'set the value of fields to the record nrecord.Fields(0) = txtnew.Text nrecord.Update 'update the record lstbook.AddItem (txtnew) 'add the item to listbox txtnew.Text = "" End Sub Private Sub cmdprint_Click() 'This procedure shows the report listreport.Refresh 'refresh report listreport.Show 'show report End Sub Private Sub Form_Load() 'This procedure configures ADODB and 'adds the data from souce to listbox Call connection 'call the required functions Call booklistrecset Call bookrecset If nrecord.RecordCount <> 0 Then nrecord.MoveFirst 'move to first record While Not nrecord.EOF 'continue until the end of file lstbook.AddItem (nrecord.Fields(0)) 'add item to the listbox from recordsource nrecord.MoveNext 'move to next record Wend 'repeat End If End Sub Private Sub lstbook_DblClick() 'delete the record If lstbook.ListIndex > -1 Then 'until the listbox is empty If MsgBox("Delete '" & lstbook.Text & "'?", vbQuestion + vbYesNo) = vbYes Then 'ask whether the user wants to delete the record 'if the response is yes then find the data and delete it If nrecord.RecordCount <> 0 Or txtnew.Text <> "" Then nrecord.MoveFirst 'move to first record Bishwanath Parajuli 293

Documentation for Easy Library Management System

While Not nrecord.EOF 'until the end of file If nrecord.Fields(0) = lstbook.Text Then 'if the record fields has the same data as selected in listbox nrecord.Delete 'delete the record and continue with: MsgBox "Record Deleted from the queue.", vbInformation, "Delete" txtnew.Text = "" End If nrecord.MoveNext 'move to next record Wend 'repeat End If lstbook.RemoveItem lstbook.ListIndex 'move the same item from listbox too End If End If End Sub Private Sub txtnew_LostFocus() 'This procedure checks an existing data If precord.RecordCount <> 0 Then precord.MoveFirst 'move to first record While Not precord.EOF 'continue until the end of file If precord.Fields(1) = txtnew.Text Then 'compare the value of textbox with the fields 'if matched continue with: MsgBox "A book with this name is in the Library.", vbInformation, "Record Exists" cmdorder.Enabled = False Exit Sub 'exit Else 'if data doesn't match then: cmdorder.Enabled = True End If precord.MoveNext 'move to next record Wend 'repeat End If If nrecord.RecordCount <> 0 Then nrecord.MoveFirst 'move to first record While Not nrecord.EOF 'continue until end of file If nrecord.Fields(0) = txtnew.Text Then 'compare the data in record fields 'if the data in textbox and record field matches then continue with: MsgBox "This book has already been requested.", vbInformation, "Record Exist" Bishwanath Parajuli 294

Documentation for Easy Library Management System

cmdorder.Enabled = False 'enable combo Exit Sub 'exit Else cmdorder.Enabled = True End If nrecord.MoveNext 'move to next record Wend 'repeat End If End Sub

Bishwanath Parajuli

295

Documentation for Easy Library Management System

frmborrowerdetails: Dim checkblank As Boolean Sub checkrestrict() 'This procedure checks the validity of the data 'by checking the total length of the numeric characters 'by checking if the character, ., is present If txtcontact <> "" Then 'check for the invalid contact If chkrestrict.Value = vbChecked Then 'if the checkbox is checked then If Len(txtcontact) < 7 Or Len(txtcontact) > 10 Then 'if the length of data in textbox is <7 and >10 MsgBox "Enter a valid number", vbExclamation, "Error" txtcontact.SetFocus 'shift focus to the specified field Exit Sub 'exit End If ElseIf chkrestrict.Value = vbUnchecked Then 'if the checkbox is unchecked then If InStr(1, txtcontact, ".") Then 'if the textbox has the character optmale.SetFocus Else MsgBox "Enter a valid address.", vbExclamation, "Error" txtcontact.SetFocus End If End If End If End Sub Private Sub chkrestrict_Click() Call checkrestrict 'call required function End Sub Private Sub cmdaddnew_Click() 'This procedure creates space for adding new data 'and generates key-field Dim code As Long 'declare code as integer Call disablenavigation 'call required function Call clear txtbrid.Locked = False 'lock the field If mrecord.RecordCount = 0 Then 'if there is no record Bishwanath Parajuli 296

Documentation for Easy Library Management System

code = 201 'set code = 201 Else mrecord.MoveLast 'move to last record code = mrecord.Fields(0) + 1 'set code = keyfield of last record +1 End If mrecord.AddNew 'addnew record txtbrid = code lbldatea = VBA.Date 'assign the textbox with system date lbldatee = Month(VBA.Date) & "/" & Day(VBA.Date) & "/" & Year(VBA.Date) + 2 'assign the textbox with date, 2years after the system date End Sub Private Sub cmdaddnew_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then 'if enter is pressed txtbrid.SetFocus End If End Sub Private Sub cmdbegin_Click() 'This procedure moves pointer to the first record On Error GoTo errhandler: If mrecord.BOF = True Then 'if recordpointer is at bof MsgBox "This is First record.", vbOKOnly, "Information" mrecord.MoveFirst 'move to first data Exit Sub Else mrecord.MoveFirst 'move recordpointer to first record Call display End If Exit Sub errhandler: MsgBox Err.Description, vbCritical, "Error" End Sub Private Sub cmdbegin_GotFocus() cmdprint.Visible = True End Sub Private Sub cmdcancel_Click() 'This procedure deletes the space reserved for saving the data Bishwanath Parajuli 297

Documentation for Easy Library Management System

'created during addnew process mrecord.CancelUpdate 'cancel update Call enablenavigation 'call required functions Call checkrecords Call clear txtbrid.Locked = True End Sub Private Sub cmdclear_Click() Call clear 'call function End Sub Private Sub cmddelete_Click() 'This procedure deletes the record from the database Dim deletedata As Integer 'declare variable On Error GoTo errhandler: deletedata = Val(InputBox("Enter the member ID of the member you want to delete.", "Delete")) 'show an inputbox to enter the data to be deleted If deletedata <> 0 Then If MsgBox("Are you sure you want to delete the record?", vbYesNo + vbQuestion, "Delete Record?") = vbYes Then If mrecord.RecordCount <> 0 Then 'if the recordset is not empty mrecord.MoveFirst 'move to first record While Not mrecord.EOF 'until eof If mrecord.Fields(0) = deletedata Then 'compare the data with that on the database mrecord.Delete 'delete the record gridtimer.Enabled = True 'enable the timer MsgBox "Record Deleted.", vbInformation, "Information" Call clear 'call the functions Call checkrecords mrecord.Close 'close the adodb record connection mrecord.Open 'open the connection End If If mrecord.RecordCount <> 0 Then mrecord.MoveNext 'move to next record End If Wend End If End If End If Exit Sub Bishwanath Parajuli 298

Documentation for Easy Library Management System

errhandler: MsgBox Err.Description, vbCritical, "Error" End Sub Private Sub cmdfind_Click() 'This procedure finds a particular record Dim find As Integer find = Val(InputBox("Enter the Member ID you want to find.", "Borrower's Details")) 'show an input box to enter the data to be found If mrecord.RecordCount <> 0 Then 'if the recordset is not empty mrecord.MoveFirst 'move the record position to first record While Not mrecord.EOF 'until the end of the file If mrecord.Fields(0) = find Then 'compare the data with find Call display 'if found display the record Exit Sub 'exit End If mrecord.MoveNext 'move to next record Wend 'repeat the process MsgBox "Record not found.", vbInformation, "Search" End If End Sub Private Sub cmdlast_Click() 'This procedure moves to the pointer to last record On Error GoTo errhandler: If mrecord.EOF = True Then 'if recordpointer is at eof MsgBox "This is Last record", vbOKOnly, "Registration" mrecord.MoveLast 'move to last record Exit Sub Else mrecord.MoveLast 'move record postion to last record Call display 'call the function End If Exit Sub 'exit errhandler: MsgBox Err.Description, vbCritical, "Error" End Sub Private Sub cmdlast_GotFocus() cmdprint.Visible = True 'show the command button Bishwanath Parajuli 299

Documentation for Easy Library Management System

End Sub Private Sub cmdmodify_Click() 'This procedure alters data from the database checkblank = False 'set the boolean value to false checkblank = checkblanks() 'retrive the value of the boolean from the function If checkblank = False Then 'if boolean is false If mrecord.RecordCount <> 0 Then 'if the recordset is not empty If MsgBox("Are you sure you want to modify?", vbYesNo) = vbYes Then mrecord.MoveFirst 'move to first record While Not mrecord.EOF 'until all the records are read If mrecord.Fields(0) = txtbrid.Text Then 'if the record and textbox matches then 'set the fields with the specified records mrecord.Fields(1) = txtfname mrecord.Fields(2) = txtmname mrecord.Fields(3) = txtsname mrecord.Fields(4) = dobpicker mrecord.Fields(5) = cmblevel If optmale.Value = True Then mrecord.Fields(7) = "Male" Else mrecord.Fields(7) = "Female" End If mrecord.Fields(6) = txtcontact mrecord.Fields(10) = lblpic.Caption mrecord.Update 'UPDATE record txtfname.SetFocus 'shift focus to the textbox MsgBox "Record Updated Sucessfully.", vbInformation, "Modify" End If mrecord.MoveNext 'move to next record Wend 'repeat End If End If End If End Sub Private Sub cmdnext_Click() 'This procedure moves pointer to relative next record On Error GoTo errhandler: If mrecord.AbsolutePosition = adPosBOF Then 'if the recordpointer is at bof Bishwanath Parajuli 300

Documentation for Easy Library Management System

mrecord.MoveLast 'move to last record Exit Sub 'exit ElseIf mrecord.EOF = True Then 'if the recordpointer is at eof MsgBox "This is Last record", vbOKOnly, "Information" mrecord.MoveLast 'move to last record Exit Sub Else Call display 'call the function mrecord.MoveNext 'move recordpointer forward End If Exit Sub errhandler: MsgBox Err.Description, vbCritical, "Error" End Sub Private Sub cmdnext_GotFocus() cmdprint.Visible = True End Sub Private Sub cmdprevious_Click() 'This procedure moves pointer to relative previous record On Error GoTo errhandler: If mrecord.AbsolutePosition = adPosEOF Then 'if recordpointer is at eof mrecord.MoveFirst 'move the recordpointer to first record Exit Sub ElseIf mrecord.BOF = True Then 'if recordpointer is at bof MsgBox "This is First record.", vbOKOnly, "Information" mrecord.MoveFirst 'move the recordpointer to first record Exit Sub Else Call display 'call the function mrecord.MovePrevious 'move recordpointer backward End If Exit Sub errhandler: MsgBox Err.Description, vbCritical, "Error" End Sub Private Sub cmdprevious_GotFocus() cmdprint.Visible = True End Sub Private Sub cmdprint_Click() Bishwanath Parajuli 301

Documentation for Easy Library Management System

'This procedure exports data from the field 'to Microsoft Word On Error GoTo errhandle: Static wa As Word.Application Static wd As Word.Document Set wa = New Word.Application Set wd = wa.Documents.add(App.Path & "\Library_Card.doc") 'set the path of worddocument 'set the value of textboxes to the specified fields of word document wd.FormFields("txtbrid").Range = txtbrid wd.FormFields("txtfname").Range = txtfname wd.FormFields("txtmname").Range = txtmname wd.FormFields("txtsname").Range = txtsname wd.FormFields("txtlevel").Range = cmblevel wd.FormFields("txtdatea").Range = lbldatea wd.FormFields("txtdatee").Range = lbldatee wa.Visible = True 'show word application Exit Sub errhandle: MsgBox Err.Description, vbCritical, "Error" wa.Quit End Sub Private Sub cmdprint_LostFocus() cmdprint.Visible = False End Sub Private Sub cmdrenew_Click() 'This procedure modifies,only the 9th field of the table If MsgBox("Do you want to renew the membership?", vbQuestion + vbYesNo, "Renew") = vbYes Then 'if message boxes are responded yes lbldatee = Month(VBA.Date) & "/" & Day(VBA.Date) & "/" & Year(VBA.Date) + 2 'set the value of textbox If mrecord.RecordCount <> 0 Then 'if the recordset is not empty mrecord.MoveFirst 'move to first record While Not mrecord.EOF 'until all the records are read If mrecord.Fields(0) = Val(txtbrid) Then 'compare the value of textbox with that on the record 'if the record is found then mrecord.Fields(9) = lbldatee 'set the value of fields equal to that of tha label 'assign the value of textbox to particular fields Bishwanath Parajuli 302

Documentation for Easy Library Management System

mrecord.Update 'update the existing record MsgBox "Membership Renewed Sucessfully.", vbInformation, "Renew" End If mrecord.MoveNext 'move to next record Wend 'repeat cmdrenew.Visible = False 'hide command button expiredtime.Enabled = False picx.Visible = False picy.Visible = True 'hide pictures Exit Sub End If End If End Sub Private Sub cmdrenew_LostFocus() cmdrenew.Visible = False End Sub Private Sub cmdsave_Click() 'This procedure saves the data in the database checkblank = False 'set the boolean to false checkblank = checkblanks() 'retrive the value of boolean from the function If checkblank = False Then 'if value of boolean is false 'set the value of the fields from the specified controls mrecord.Fields(0) = txtbrid mrecord.Fields(1) = txtfname mrecord.Fields(2) = txtmname mrecord.Fields(3) = txtsname mrecord.Fields(4) = dobpicker mrecord.Fields(5) = cmblevel mrecord.Fields(6) = txtcontact If optmale.Value = True Then mrecord.Fields(7) = "Male" Else mrecord.Fields(7) = "Female" End If mrecord.Fields(8) = lbldatea mrecord.Fields(9) = lbldatee mrecord.Fields(10) = lblpic.Caption mrecord.Update 'SAVE record and continue: gridtimer.Enabled = True 'enable timer txtbrid.Locked = True 'lock the textbox MsgBox "Record Saved.", vbInformation, "Information" Bishwanath Parajuli 303

Documentation for Easy Library Management System

Call enablenavigation 'call function txtbrid.SetFocus 'shift focus to textbox End If End Sub Private Sub Form_Unload(Cancel As Integer) 'unload the form given below Unload frmissue Unload frmrnunreturn Unload frmreserve End Sub Private Sub memebergrid_Click() 'This procedure exports the data from datagrid to the fields If adomember.Recordset.RecordCount <> 0 Then txtbrid = memebergrid.Columns(0) txtfname = memebergrid.Columns(1) txtmname = memebergrid.Columns(2) txtsname = memebergrid.Columns(3) dobpicker = memebergrid.Columns(4) cmblevel = memebergrid.Columns(5) txtcontact = memebergrid.Columns(6) If memebergrid.Columns(7) = "Male" Then optmale.Value = True Else optfemale.Value = True End If lbldatea = memebergrid.Columns(8) lbldatee = memebergrid.Columns(9) lblpic.Caption = memebergrid.Columns(10) memimage = LoadPicture(lblpic.Caption) tabs.TabVisible(1) = False txtfname.SetFocus tabs.TabVisible(1) = True End If End Sub Private Sub Form_Load() 'This procedure configures ADODB and ADODC controls Call connection Call memeberrecset Call clear Call enablenavigation Call checkrecords

Bishwanath Parajuli

304

Documentation for Easy Library Management System

adomember.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data source = " & App.Path & "\Library Management System.mdb" 'configure provider and application path adomember.CommandType = adCmdUnknown adomember.RecordSource = "select * from tblmember" 'specify the table adomember.Refresh 'refresh adodc End Sub Private Sub frapicture_Click() memimage = LoadPicture("") 'clear picture lblpic.Caption = "" 'clear labels lbl2.Visible = False End Sub Private Sub memimage_Click() 'This procedure opens a dialog box for displaying image 'and saves image in the application path commdialog.Filter = "*.jpgfile|*.jpg" 'filter filetypes with extension '.jpg' Me.commdialog.ShowOpen 'open common dialog box If Me.commdialog.FileName <> "" Then 'if filename is specified 'assign the label with filename memimage = LoadPicture(Me.commdialog.FileName) 'load picture from the location in filename SavePicture memimage, App.Path & "\" & Me.commdialog.FileTitle 'save the picture to application path lblpic.Caption = commdialog.FileTitle End If If lblpic.Caption = "" Then lbl2.Visible = False Else lbl2.Visible = True End If End Sub Private Sub gridtimer_Timer() 'This procedure refreshes the datagrid memebergrid.Refresh adomember.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data source = " & App.Path & "\Library Management System.mdb" Bishwanath Parajuli 305

Documentation for Easy Library Management System

'configure provider and application path adomember.CommandType = adCmdUnknown adomember.RecordSource = "select * from tblmember" 'specify the table adomember.Refresh 'refresh adodc memebergrid.Refresh 'refresh datagrid gridtimer.Enabled = False End Sub Private Sub expiredtime_Timer() 'This procedure changes background color of the picture box Dim count As Integer 'declare the variable count = 0 'specify the background colour of the image If picx.BackColor = &HC0C0FF Then picx.BackColor = &H80000004 ElseIf picx.BackColor = &H80000004 Then picx.BackColor = &HC0C0FF End If End Sub Private Sub tabs_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then 'if enter is pressed If tabs.Caption = "Form View" Then 'and the tab caption is Form View cmdaddnew.SetFocus 'shift focus to the command button End If End If End Sub Private Sub txtbrid_KeyPress(KeyAscii As Integer) 'accept those keypresses which are numeric and backspaces only If Not ((KeyAscii >= 48 And KeyAscii <= 57) Or KeyAscii = 8) Then KeyAscii = 0 End If End Sub Private Sub txtbrid_LostFocus() 'This procedure searches for any existing keyfield Dim find As Long 'declare 'find' as long find = Val(txtbrid) 'assign find with textbox If cmdaddnew.Enabled = False Then If mrecord.RecordCount <> 0 Then mrecord.CancelUpdate 'cancel the saving process Bishwanath Parajuli 306

Documentation for Easy Library Management System

'if there is record in record named 'mrecord' mrecord.MoveFirst 'move the record position to first record While Not mrecord.EOF 'until the end of the file If mrecord.Fields(0) = find Then 'compare the record with find Call display 'call the function txtbrid.SetFocus 'shift focus to the textbox MsgBox "This ID exists already.", vbInformation End If mrecord.MoveNext 'move to next record Wend 'repeat the process mrecord.AddNew 'resume the saving process End If End If End Sub Private Sub lbldatee_Change() 'This procedure checks if the data in the specified label 'match the condition belo If txtbrid.Text <> "" Then expire = DateDiff("d", lbldatee, VBA.Date) 'Find the difference in the value of date If expire > 0 Then MsgBox "Your membership has expired. Please Renew!", vbInformation, "Expiration" expiredtime.Enabled = True 'configure controls picy.Visible = False picx.Visible = True cmdrenew.Visible = True Exit Sub Else expiredtime.Enabled = False picx.Visible = False picy.Visible = True cmdrenew.Visible = False Exit Sub End If End If End Sub Private Sub txtcontact_KeyPress(KeyAscii As Integer) If Me.chkrestrict.Value = vbChecked Then 'if checkbox is checked Me.txtcontact.MaxLength = 10 'set the maximum available space in the textbox to 10 Bishwanath Parajuli 307

Documentation for Easy Library Management System

'accept those keypresses which are numeric and backspaces only If Not ((KeyAscii >= 48 And KeyAscii <= 57) Or KeyAscii = 8) Then KeyAscii = 0 End If ElseIf Me.chkrestrict.Value = vbUnchecked Then 'if checkbox is unchecked Me.txtcontact.MaxLength = 30 'set the maximum available space in the textbox to 30 End If End Sub Private Sub txtcontact_LostFocus() Call checkrestrict 'call the function End Sub Private Sub txtfname_Change() If txtfname = "" Then lblfname.Caption = "" Else lblfname.Caption = txtfname End If End Sub Sub display() 'This procedure assigns the data in specified fields 'from the record source On Error GoTo handle: txtbrid = mrecord.Fields(0) txtfname = mrecord.Fields(1) txtmname = mrecord.Fields(2) txtsname = mrecord.Fields(3) dobpicker = mrecord.Fields(4) cmblevel = mrecord.Fields(5) txtcontact = mrecord.Fields(6) If mrecord.Fields(7) = "Male" Then optmale.Value = True Else optfemale.Value = True End If lbldatea = mrecord.Fields(8) lbldatee = mrecord.Fields(9) lblpic.Caption = mrecord.Fields(10) memimage = LoadPicture(App.Path & "/" & mrecord.Fields(10)) 'load picture Bishwanath Parajuli 308

Documentation for Easy Library Management System

lblrecordnumber.Caption = mrecord.AbsolutePosition & " Of " & mrecord.RecordCount & " Records" Exit Sub handle: MsgBox Err.Description, vbCritical, "Error" End Sub Private Sub txtsname_Change() If txtsname = "" Then lblsname.Caption = "" Else lblsname = txtsname End If End Sub Sub clear() 'This procedure resets all the fields lbl2.Visible = False lblsname = "" lblfname = "" expiredtime.Enabled = False picx.Visible = False picy.Visible = False txtbrid = "" txtfname = "" txtmname = "" txtsname = "" txtdob = "" txtcontact = "" dobpicker = VBA.Date lbldatea.Caption = "" lbldatee.Caption = "" optmale.Value = False optfemale.Value = False cmblevel.clear chkrestrict.Value = vbUnchecked For i = 1 To 10 cmblevel.AddItem i Next i cmblevel.AddItem "Teachers and Staffs" lblpic.Caption = "" memimage = LoadPicture("") End Sub Sub checkrecords() 'This procedure enables/disables the navigation buttons Bishwanath Parajuli 309

Documentation for Easy Library Management System

If mrecord.RecordCount = 0 Then franavigation.Enabled = False 'disable frame ElseIf mrecord.RecordCount <> 0 Then franavigation.Enabled = True 'enable frame End If End Sub Sub enablenavigation() 'This procedure enables command controls franavigation.Enabled = True cmddelete.Enabled = True cmdaddnew.Enabled = True cmdsave.Enabled = False cmdcancel.Enabled = False cmdmodify.Enabled = True End Sub Sub disablenavigation() 'This procedure disables command controls franavigation.Enabled = False cmddelete.Enabled = False cmdaddnew.Enabled = False cmdsave.Enabled = True cmdcancel.Enabled = True cmdmodify.Enabled = False End Sub Function checkblanks() As Boolean 'This procedure checks for any unattended fields in the form If txtbrid = "" Or txtfname = "" Or txtsname = "" Or dobpicker = "" Or txtcontact = "" Or lblpic.Caption = "" Then 'if the textboxes specified above are blank MsgBox "Please fill all the required fields.", vbExclamation, "Error" checkblanks = True 'set the boolean value to true Exit Function 'exit End If If (optmale.Value = False And optfemale.Value = False) Then 'if the options above are unchecked MsgBox "Please, specify the gender.", vbExclamation, "Error" checkblanks = True Exit Function End If End Function Bishwanath Parajuli 310

Documentation for Easy Library Management System

frmemail: Private Sub cmdsend_Click() 'This procedure sends the data to specified address through 'Microsoft Outlook On Error GoTo errhandle If txtadd.Text = "" Or txtsubject.Text = "" Or txtbody.Text = "" Then 'if the textboxes specified above are blank MsgBox "Please fill in all the fields.", vbExclamation, "Error" Exit Sub 'exit End If Dim frmsOutlook As Object 'declare the objects Dim frmsMailItem As Object Set frmsOutlook = CreateObject("Outlook.Application") 'open outlook Set frmsMailItem = frmsOutlook.CreateItem(0) 'create a new mail window frmsMailItem.Recipients.add txtadd.Text 'set the value of txtadd as address of the recipent frmsMailItem.Subject = txtsubject.Text 'set the subject frmsMailItem.Body = txtbody.Text 'set the body frmsMailItem.Send 'send the mail Set frmsOutlook = Nothing 'close outlook Exit Sub errhandle: MsgBox Err.Description, vbCritical, "Error" End Sub Private Sub txtadd_LostFocus() 'This procedure checks if the required characters are present 'in the field specified below If InStr(1, txtadd, ".") And InStr(1, txtadd, "@") Then 'if the the textbox has character . and @ txtsubject.SetFocus 'shift focus to subject box Else MsgBox "Enter a valid email address.", vbExclamation, "Error" txtadd.SetFocus 'shift focus to the same box End If Bishwanath Parajuli 311

Documentation for Easy Library Management System

End Sub

Bishwanath Parajuli

312

Documentation for Easy Library Management System

frmfinecollection: Private Sub chkdet_Click() If chkdet.Value = vbChecked Then 'if the checkbox is checked Me.Height = 5490 'set the specified height ElseIf chkdet.Value = vbUnchecked Then 'if the checkbox is unchecked Me.Height = 2385 End If End Sub Private Sub cmdcalculate_Click() 'This procedure find the item with similar fields 'and sums up the 7th field of the record to display it Dim id, fine As Integer 'declare variables id = Val(InputBox("Enter the Borrower ID.", "Fine")) 'show input box to input a data If id <> 0 Then 'if the variable do have some data If srecord.RecordCount <> 0 Then 'if the recordset is not empty srecord.MoveFirst 'move to first record While Not srecord.EOF 'until end of file If srecord.Fields(3) = id Then 'compare the value of variable and data in recordsource fine = srecord.Fields(7) + fine 'add the value of fields for matched data End If srecord.MoveNext 'move to next record Wend 'repeat End If MsgBox "The borrower has fine of Rs." & fine & " paid.", vbInformation, "Fine" End If End Sub Private Sub cmdcollect_Click() 'This procedure deletes all the records from the table On Error GoTo errhandle: If srecord.RecordCount <> 0 Then 'show input box to input a data If MsgBox("Have you received all the money collected?", vbYesNo + vbQuestion, "Collection") = vbYes Then 'if messagebox returns with yes response then brecord.MoveFirst 'move to first record While Not brecord.EOF 'until all the records are read Bishwanath Parajuli 313

Documentation for Easy Library Management System

brecord.Delete 'delete all the record finetime.Enabled = True 'enable timer brecord.MoveNext 'move to next record Wend 'repeat MsgBox "All the records in fine table has been deleted.", vbInformation, "Collection" End If End If Exit Sub errhandle: MsgBox Err.Description, vbExclamation, "Error" End Sub Private Sub Form_Load() 'This procedure configures ADODB and ADODC 'and displays the sum of 7th field of the table at startup Dim fine As Integer 'declare variable Call connection 'call the function Call qryfinerecset Call finerecset fine = 0 If srecord.RecordCount <> 0 Then srecord.MoveFirst 'move to first record While Not srecord.EOF 'until all the records are read, fine = srecord.Fields(7) + fine 'sum up all the data in the specfied field srecord.MoveNext 'move to next record Wend 'repeat ElseIf srecord.RecordCount = 0 Then cmdcollect.Enabled = False 'disable the button End If lblfine.Caption = fine 'set the value of variable in label adofine.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data source = " & App.Path & "\Library Management System.mdb" 'configure provider and application path adofine.CommandType = adCmdUnknown adofine.RecordSource = "Select * from qryfine" 'specify the query adofine.Refresh 'refresh adodc End Sub Private Sub finetime_Timer() 'This procedure refreshes the datagrid finegrid.Refresh 'refresh the datagrid Bishwanath Parajuli 314

Documentation for Easy Library Management System

adofine.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data source = " & App.Path & "\Library Management System.mdb" 'configure provider and application path adofine.CommandType = adCmdUnknown adofine.RecordSource = "Select * from qryfine" 'specify the query adofine.Refresh 'refresh adodc finegrid.Refresh finetime.Enabled = False End Sub

Bishwanath Parajuli

315

Documentation for Easy Library Management System

frmglance: Sub add() 'This procedure adds data in the combo box cmbdays.clear For i = 2 To 30 cmbdays.AddItem i Next i End Sub Private Sub chkshow_Click() If chkshow.Value = vbChecked Then lsvbook.ListItems.clear 'clear listview Call add cmbdays.Enabled = True ElseIf chkshow.Value = vbUnchecked Then cmbdays.Enabled = False Call listings End If End Sub Private Sub cmbdays_Click() 'This procedure adds the data selected from the box 'with today's data and alters the color of the text 'if those data have the value of 5th field less than the sum lsvbook.ListItems.clear 'clear listview If bdrecord.RecordCount <> 0 Then Dim lstitem As ListItem 'declare lstitem as listview's items bdrecord.MoveFirst 'move to first record of 'bdrecord' While Not bdrecord.EOF 'until all the records are read Set lstitem = lsvbook.ListItems.add(, , bdrecord!Title) 'set the value in first column header 'add the items from the fields of the 'bdrecord' lstitem.SubItems(1) = bdrecord.Fields(3) If bdrecord.Fields(5) < VBA.Date + Day(cmbdays) Then lstitem.SubItems(2) = "Crossed its due date." 'set the color of the text to red lstitem.ForeColor = vbRed lstitem.ListSubItems(1).ForeColor = vbRed lstitem.ListSubItems(2).ForeColor = vbRed ElseIf bdrecord.Fields(5) >= VBA.Date + Day(cmbdays) Then 'if the fields has value more than lstitem.SubItems(2) = "Valid till today." Bishwanath Parajuli 316

Documentation for Easy Library Management System

End If bdrecord.MoveNext 'move to next record Wend 'repeat End If End Sub Private Sub Form_Load() 'This procedure configure ADODB Call add 'call the function Call connection Call qryissuerecset Call listings cmbdays.Enabled = False 'enable combo End Sub Sub listings() 'This procedure list the data into the list view lsvbook.ListItems.clear 'clear list view If bdrecord.RecordCount <> 0 Then 'if the recordset is not empty Dim lstitem As ListItem 'declare lstitem as listview's items bdrecord.MoveFirst 'move to first record While Not bdrecord.EOF 'until end of file Set lstitem = lsvbook.ListItems.add(, , bdrecord!Title) 'set the value of first column header 'add the items from the fields of the 'bdrecord' lstitem.SubItems(1) = bdrecord.Fields(3) If bdrecord.Fields(5) < VBA.Date Then 'if the data in the field is less than system date 'specify the text and color for the sub-items lstitem.SubItems(2) = "Crossed its due date." lstitem.ForeColor = vbRed lstitem.ListSubItems(1).ForeColor = vbRed lstitem.ListSubItems(2).ForeColor = vbRed Else lstitem.SubItems(2) = "Valid till today." End If bdrecord.MoveNext 'move to next record Wend 'repeat End If End Sub Private Sub lsvbook_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader) 'This procedure toggles the clicked column's sort order 'only if the active column is clicked Bishwanath Parajuli 317

Documentation for Easy Library Management System

If (lsvbook.SortKey = ColumnHeader.Index - 1) Then ColumnHeader.Tag = Not Val(ColumnHeader.Tag) End If 'set sort order to that of the respective ListSortOrderConstants value lsvbook.SortOrder = Abs(Val(ColumnHeader.Tag)) 'get the zero-based index of the clicked column. lsvbook.SortKey = ColumnHeader.Index - 1 'sort the column lsvbook.Sorted = True End Sub

Bishwanath Parajuli

318

Documentation for Easy Library Management System

frmhistory: Private Sub chkdet_Click() If chkdet.Value = vbChecked Then 'if checkbox is unchecked Me.Height = 7800 'set the height of the form ElseIf chkdet.Value = vbUnchecked Then 'if checkbox is unchecked Me.Height = 3900 End If End Sub Private Sub Form_Load() 'This procedure configures ADODB and ADODC 'and adds item to the listbox adohistory.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data source = " & App.Path & "\Library Management System.mdb" 'configure provider and application path adohistory.CommandType = adCmdUnknown adohistory.RecordSource = "select * from qryhistory" 'specify the query adohistory.Refresh 'refresh the adodc If adohistory.Recordset.RecordCount <> 0 Then 'if the recordset is not empty adohistory.Recordset.MoveFirst 'move to first record While Not adohistory.Recordset.EOF 'until eof lstbooks.AddItem (adohistory.Recordset.Fields(0)) 'populate the list box adohistory.Recordset.MoveNext 'move to next record Wend 'repeat End If End Sub Private Sub lstbooks_Click() 'This procedure shows the data, with that keyfield, 'clicked in the listbox If lstbooks.ListIndex >= 0 Then 'if there is atleast a data in listbox If adohistory.Recordset.RecordCount <> 0 Then adohistory.Recordset.MoveFirst 'move to first record While Not adohistory.Recordset.EOF 'until eof If lstbooks.Text = adohistory.Recordset.Fields(0) Then 'if the text selected is found 'set the value from the recordset to specified fields lblbcode.Caption = adohistory.Recordset.Fields(1) Bishwanath Parajuli 319

Documentation for Easy Library Management System

lbltitle.Caption = adohistory.Recordset.Fields(2) lblsid.Caption = adohistory.Recordset.Fields(3) lblname.Caption = adohistory.Recordset.Fields(4) lbldatei.Caption = adohistory.Recordset.Fields(5) lblcomments.Caption = "Comments:- " & adohistory.Recordset.Fields(7) End If adohistory.Recordset.MoveNext 'move to next record Wend 'repeat End If End If End Sub

Bishwanath Parajuli

320

Documentation for Easy Library Management System

frmissue: Option Explicit Dim check As Boolean 'declare the variable Private Sub cmbbid_Click() 'This procedure displays the details of the data linked_ 'with the item clicked in the box If precord.RecordCount <> 0 Then 'if the recordset is not empty precord.MoveFirst 'move to first record While Not precord.EOF 'until eof If precord.Fields(0) = cmbbid Then 'compare the field and combo 'specify the fields with the corresponding field value lblbtitle.Caption = precord.Fields(1) lbltype.Caption = precord.Fields(3) If precord.Fields(3) = "Reference" Then 'if the field value is as specified above MsgBox "A reference book is prohibited to issue.", vbInformation, "Error" cmdsave.Enabled = False 'disable the button Call clear 'call the function Exit Sub 'exit End If End If precord.MoveNext 'move to next record Wend 'repeat End If Call bremain 'call the function End Sub Private Sub cmbbid_GotFocus() Dim code As Integer 'decalre the variable If bdrecord.RecordCount = 0 Then 'if there is no record in the recordset code = 301 'set the specified value of code Else bdrecord.MoveLast 'move record pointer to last record code = bdrecord.Fields(0) + 1 'increase the value of code by 1 with respect to last data End If lblissueid = code 'set the value of code in the label End Sub Private Sub cmbbrid_Click() Bishwanath Parajuli 321

Documentation for Easy Library Management System

'This procedure displays the details of the data linked_ 'with the item clicked in the box On Error GoTo errhandler: If mrecord.RecordCount <> 0 Then mrecord.MoveFirst 'move to first record While Not mrecord.EOF 'until eof If mrecord.Fields(0) = Int(cmbbrid) Then 'compare the combo and field value 'set the value of field in specified field of form if matched lblbrfname.Caption = mrecord.Fields(1) lblbrmname.Caption = mrecord.Fields(2) lblbrsname.Caption = mrecord.Fields(3) If mrecord.Fields(5) = "Teachers and Staffs" Then lblbtype.Caption = "The member is a Teacher or a Staff." Else lblbtype.Caption = "The member is at " & mrecord.Fields(5) & " class." End If lblpic.Caption = App.Path & "/" & mrecord.Fields(10) imgpic = LoadPicture(lblpic.Caption) 'load the picture If mrecord.Fields(9) < VBA.Date Then 'if field has date less than system date cmdsave.Enabled = False 'disable the command button If MsgBox("Memebership has expired. Do you want to renew membership?", vbCritical + vbYesNo, "Error") = vbYes Then Me.Hide 'hide the form frmborrowerdetails.Show 'show the form frmborrowerdetails.display 'call a function from the new form Exit Sub Else MsgBox "Issue cannot be continued.", vbCritical, "Error" Call clear 'call function End If Exit Sub 'exit End If End If mrecord.MoveNext 'move to next record Wend 'repeat End If Call check_reserve 'call function Exit Sub Bishwanath Parajuli 322

Documentation for Easy Library Management System

errhandler: MsgBox Err.Description, vbCritical, "Error" End Sub Private Sub cmdsave_Click() 'This procedure saves the required data in database If cmbbid.Text = "" Or cmbbrid.Text = "" Then 'if the text areas in combo are empty MsgBox "Please, enter the required Fields.", vbExclamation, "Error" Exit Sub 'exit End If check = False 'set the value of boolean to false check = borrower_check() 'check for the value of boolean If check = False Then 'if the value of boolean returns with the value false bdrecord.AddNew 'add new record 'specify the value of form fields to recordset's field bdrecord.Fields(0) = lblissueid.Caption bdrecord.Fields(1) = Val(cmbbid) bdrecord.Fields(2) = Val(cmbbrid) bdrecord.Fields(3) = lbldatei.Caption bdrecord.Fields(4) = lbldater.Caption bdrecord.Fields(5) = txtmemo.Text bdrecord.Fields(6) = "Yes" bdrecord.Fields(7) = Me.lbltype bdrecord.Update 'save record MsgBox "Record Saved.", vbInformation, "Information" cmdsave.Enabled = False 'disable controls cmbbrid.Enabled = False Me.cmbbid.SetFocus 'shift focus to combo Call clear 'call function End If End Sub Private Sub cmdclear_Click() Call clear 'call function End Sub Private Sub cmdsave_GotFocus() If txtmemo.Text = "" Then 'if textbox is empty txtmemo.Text = "No comments" 'set the value as specified above Bishwanath Parajuli 323

Documentation for Easy Library Management System

End If End Sub Private Sub Form_Load() 'This procedure configures ADODB connection Call connection 'call the function Call bookrecset Call memeberrecset Call issuerecset Call reserverecset Call additemid lbldatei.Caption = VBA.Date 'set system date in label End Sub Sub clear() 'This procedure resets the value of fields txtmemo.Text = "" cmbbrid.clear cmbbid.clear Call additemid 'call the function lbltype.Caption = "" lblbtitle = "" lblbrfname = "" lblbrmname = "" lblbrsname = "" lbldater.Caption = "" lblpic.Caption = "" imgpic = LoadPicture("") End Sub Sub bremain() 'This procedure checks "books that can be issued" Dim count, countr, br As Integer 'declare variable count = 0 countr = 0 If bdrecord.RecordCount <> 0 Then bdrecord.MoveFirst 'move to first record While Not bdrecord.EOF 'until eof If bdrecord.Fields(1) = cmbbid Then 'compare the combo with field value 'if matched increase count by 1 count = count + 1 End If bdrecord.MoveNext 'move to next record Wend 'repeat End If Bishwanath Parajuli 324

Documentation for Easy Library Management System

If lrecord.RecordCount <> 0 Then lrecord.MoveFirst While Not lrecord.EOF If lrecord.Fields(1) = cmbbid Then countr = countr + 1 End If lrecord.MoveNext Wend End If If precord.RecordCount <> 0 Then precord.MoveFirst While Not precord.EOF br = precord.Fields(4) - (countr + count) 'find the value of br using calculation given above If precord.Fields(0) = cmbbid Then If count >= precord.Fields(4) Then 'compare the value of count with specified field 'if equal or greater than fields MsgBox "All the books of this code has been issued.", vbInformation, "Issue" Me.cmdsave.Enabled = False 'disable control Exit Sub ElseIf br > 0 Then Me.cmdsave.Enabled = True 'enable control ElseIf br <= 0 Then MsgBox "This book has been reserved.", vbInformation, "Issue" Me.cmdsave.Enabled = False End If End If precord.MoveNext Wend End If End Sub Function borrower_check() As Boolean 'This procedure checks "due status and issue status of borrower" Dim count, a As Integer 'declare the variable count = 0 a=0 If bdrecord.RecordCount <> 0 Then 'if the recordset does have some record bdrecord.MoveFirst 'move to first record Bishwanath Parajuli 325

Documentation for Easy Library Management System

While Not bdrecord.EOF 'until end of file If bdrecord.Fields(2) = cmbbrid Then 'if field and combo matches 'increase the value of count by 1 count = count + 1 If bdrecord.Fields(4) < VBA.Date Then 'if the field value is less than system date borrower_check = True 'set boolean value to true cmdsave.Enabled = False 'disable button If MsgBox("This borrower has fine to pay. Do you want to fine him/her?.", vbYesNo, "Issue") = vbYes Then Unload Me 'close the form frmrnunreturn.Show frmrnunreturn.cmdrenew.Enabled = False frmrnunreturn.cmdreturn.Enabled = False Exit Function 'exit Else MsgBox "This borrower can issue no more books.", vbExclamation, "Error" cmdsave.Enabled = False End If Else cmdsave.Enabled = True End If End If bdrecord.MoveNext 'move to next record Wend 'repeat End If If bdrecord.RecordCount <> 0 Then bdrecord.MoveFirst While Not bdrecord.EOF If bdrecord.Fields(1) = cmbbid And bdrecord.Fields(2) = Int(cmbbrid) Then a=a+1 End If bdrecord.MoveNext Wend End If If count >= 3 Then borrower_check = True MsgBox "This borrower has already borrowed 3 books. Issue will be cancelled.", vbCritical, "Issue" cmdsave.Enabled = False Exit Function Bishwanath Parajuli 326

Documentation for Easy Library Management System

Else cmdsave.Enabled = True 'enable command button End If If a >= 1 Then borrower_check = True MsgBox "A borrower cannot borrow two same books at time. Issue will be cancelled.", vbCritical, "Issue" cmdsave.Enabled = False Exit Function Else cmdsave.Enabled = True End If End Function Sub check_reserve() 'This procedure checks if the book to be issued_ 'is reserved by other member or by the same borrower Dim countn As Integer 'declare variable countn = 0 If lrecord.RecordCount <> 0 Then 'if the recordset is not empty lrecord.MoveFirst 'move to first record While Not lrecord.EOF 'until eof If lrecord.Fields(1) = cmbbid.Text Then 'compare the field's and combo's value 'if matched If lrecord.Fields(1) = cmbbid.Text And lrecord.Fields(2) = Int(cmbbrid.Text) Then If MsgBox("This book has been reserved by the current borrower. Do you want to delete the record?", vbQuestion + vbYesNo, "Reservation") = vbYes Then lrecord.Delete 'delete the record Exit Sub 'exit Else cmdsave.Enabled = False 'disable button Exit Sub End If End If End If lrecord.MoveNext 'move to next record Wend 'repeat End If If precord.RecordCount <> 0 Then precord.MoveFirst Bishwanath Parajuli 327

Documentation for Easy Library Management System

While Not precord.EOF If precord.Fields(0) = cmbbid Then If countn >= precord.Fields(4) Then 'compare the value of variable and field data MsgBox "All the books of this code has been Reserved. Issue cannot be completed.", vbInformation, "Issue" cmdsave.Enabled = False Exit Sub ElseIf countn < precord.Fields(4) Then cmdsave.Enabled = True 'enable button End If End If precord.MoveNext Wend End If End Sub Private Sub lbltype_Change() 'This procedure changes the value of the label_ 'according to the text displayed If lbltype.Caption = "Non Fiction" Then 'if the label's caption is as specified lbldater.Caption = VBA.Date + Day(7) 'set label's value 7 days more than system date ElseIf lbltype.Caption = "Periodical" Then lbldater.Caption = VBA.Date + Day(7) ElseIf lbltype.Caption = "Reference" Then lbldater.Caption = "Issue Prohibited" ElseIf lbltype.Caption = "Fiction" Then lbldater.Caption = VBA.Date + Day(14) End If End Sub Sub additemid() 'This procedure adds item into combo-boxes If precord.RecordCount <> 0 Then 'if recordset is not empty precord.MoveFirst 'move to first record While Not precord.EOF 'until eof cmbbid.AddItem precord.Fields(0) 'populate data into combo precord.MoveNext 'move to next record Wend 'repeat End If If mrecord.RecordCount <> 0 Then Bishwanath Parajuli 328

Documentation for Easy Library Management System

mrecord.MoveFirst While Not mrecord.EOF cmbbrid.AddItem mrecord.Fields(0) mrecord.MoveNext Wend End If End Sub

Bishwanath Parajuli

329

Documentation for Easy Library Management System

frmlinker: 'This form is used to display the form_ 'based on the users selection Private Sub optrenew_Click() Unload Me 'unload the form frmrnunreturn.Show 'show the form frmrnunreturn.cmdrenew.Visible = True frmrnunreturn.cmdreturn.Visible = False End Sub Private Sub optreturn_Click() Unload Me frmrnunreturn.Show frmrnunreturn.cmdrenew.Visible = False frmrnunreturn.cmdreturn.Visible = True End Sub

Bishwanath Parajuli

330

Documentation for Easy Library Management System

frmLogin: Private Sub cmdcancel_Click() Unload Me 'unload the form Unload mdimain End Sub Private Sub cmdok_Click() 'This procedure determines the access rights of the user 'based upon usertype If txtusername = "" And txtpassword = "" Then 'if the textbox are empty mdimain.Hide 'hide mdi window mdimain.sbrmain.Panels(3).Text = "User :- Visitor" 'specify the data to be displayed in statusbar 'continue with disabling the menu items: mdimain.mnumanagement.Enabled = False mdimain.mnusettings.Enabled = False mdimain.mnureserve.Enabled = False mdimain.mnuissue.Enabled = False mdimain.mnurenewreturn.Enabled = False mdimain.mnutotalfine.Enabled = False mdimain.mnureports.Enabled = False mdimain.mnurequest.Enabled = False mdimain.mnuprefer.Enabled = False mdimain.tbrmain.Buttons(1).Enabled = False mdimain.tbrmain.Buttons(3).Enabled = False mdimain.tbrmain.Buttons(5).Enabled = False mdimain.tbrmain.Buttons(9).Enabled = False Unload Me frmSplash.Show 'show the form Exit Sub 'exit ElseIf precord.RecordCount <> 0 Then 'if recordset is not empty precord.MoveFirst 'move to first record While Not precord.EOF 'until eof If txtusername = precord.Fields(0) Then 'compare the data and field value and if matched If txtpassword = precord.Fields(2) And precord.Fields(1) = "Administrator/Head Librarian" Then mdimain.Hide mdimain.sbrmain.Panels(3).Text = "User :Administrator (" & txtusername.Text & ")" Unload Me frmSplash.Show 'show form Exit Sub Bishwanath Parajuli 331

Documentation for Easy Library Management System

ElseIf txtpassword = precord.Fields(2) And precord.Fields(1) = "General User" Then mdimain.Hide mdimain.sbrmain.Panels(3).Text = "User :- General User (" & txtusername.Text & ")" mdimain.mnumanagement.Enabled = False mdimain.mnutotalfine.Enabled = False mdimain.mnuprefer.Enabled = False mdimain.tbrmain.Buttons(3).Enabled = False Unload Me frmSplash.Show Exit Sub Else 'if username doesn't match then MsgBox "Invalid Password, try again!", vbCritical, "Login" txtpassword.SetFocus 'shift focus to the textbox Exit Sub End If End If precord.MoveNext 'move to next record Wend 'repeat MsgBox "Invalid Username, try again!", vbCritical, "Login" txtusername.SetFocus End If End Sub Private Sub Form_Load() 'This procedure configures ADODB connection On Error GoTo errhandle: 'if error occurs read errhandle Call connection 'call the functions Call security Call preferrecset Exit Sub 'exit errhandle: MsgBox Err.Description & "#" & Err.Number & ". The application will now terminate. Sorry for the inconvenience.", vbCritical, "Fatal Error" Unload Me 'unload the form End Sub

Bishwanath Parajuli

332

Documentation for Easy Library Management System

frmnuserandcpass: Dim checklib As Boolean Private Sub cmbusertype_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then 'if enter is pressed txtpassword.SetFocus 'shift focus to the field End If End Sub Private Sub cmdaddnewuser_Click() 'This procedure creates space for saving data 'and saves the data in it If txtpassword = "" Or txtusername = "" Or txtcpassword = "" Then 'if textareas are empty MsgBox "Please, fill the fields.", vbExclamation, "Error" Exit Sub 'exit End If If txtpassword <> txtcpassword Then 'if the data in the textboxes dont match MsgBox "Your Passwords don't match.", vbInformation, "Error" Exit Sub 'exit Else checklib = False 'set the boolean to false checklib = checklibrarian() 'get the value of boolean from the function specified 'if the boolean returns with the value false then If checklib = False Then precord.AddNew 'add new record 'set field value with the data from specified object precord.Fields(0) = txtusername precord.Fields(1) = cmbusertype precord.Fields(2) = txtpassword precord.Update 'save the record txtusername.SetFocus MsgBox "Username Updated.", vbInformation, "Library Management" End If End If End Sub Private Sub cmdexit_Click() Unload Me 'unload the form End Sub Bishwanath Parajuli 333

Documentation for Easy Library Management System

Private Sub cmdclear_Click() Call clearallfields 'call function End Sub Private Sub cmdclear1_Click() 'This procedure clears the fields located in the tabs txtuser = "" txtopass = "" txtnpass = "" txtcpass = "" End Sub Private Sub cmddelete_Click() 'This procedure deletes the record from the specified record table If txtusern.Text = "" Or txtpassd.Text = "" Then 'if the textboxes are empty MsgBox "Please, fill the fields.", vbExclamation, "Error" Exit Sub 'exit End If If precord.RecordCount <> 0 Then 'if recordset is not empty precord.MoveFirst 'move to first record While Not precord.EOF 'until eof If precord.Fields(0) = txtusern Then 'compare field value and textbox's value and if matched If MsgBox("Are you sure you want to delete this record?", vbYesNo + vbQuestion, "Delete User") = vbYes Then precord.Delete 'delete the data MsgBox "User deleted sucessfully", vbInformation, "Memeber Deleted" txtusern.Text = "" txtpassd.Text = "" txtusern.SetFocus 'shift focus to textbox End If End If precord.MoveNext 'move to next record Wend 'repeat End If End Sub Private Sub cmddelete_GotFocus() 'This procedure checks if the data in the fields match_ 'with that on the database Bishwanath Parajuli 334

Documentation for Easy Library Management System

Dim find As String 'declare variable find = txtpassd 'se the variable with textbox's data If precord.RecordCount <> 0 Then 'if the recordset is not empty precord.MoveFirst 'move to the first record While Not precord.EOF 'until end of file If precord.Fields(0) = Me.txtusern And precord.Fields(2) = find Then 'if the data and field value match cmddelete.SetFocus 'shift focus Exit Sub 'exit End If precord.MoveNext 'move to next record Wend 'repeat MsgBox "Your password doesn't match with that on database.", vbInformation, "Information" txtpassd.SetFocus End If End Sub Private Sub Form_Load() 'This procedure configures ADODB connection Call connection 'call the functions Call security Call clearallfields End Sub Private Sub txtcpass_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then 'if enter is pressed Me.cmdchngpass.SetFocus 'shift focus End If End Sub Private Sub txtcpassword_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then cmdaddnewuser.SetFocus End If End Sub Private Sub txtnpass_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then Me.txtcpass.SetFocus End If End Sub Private Sub txtopass_KeyPress(KeyAscii As Integer) Bishwanath Parajuli 335

Documentation for Easy Library Management System

If KeyAscii = 13 Then Me.txtnpass.SetFocus End If End Sub Private Sub txtpassd_GotFocus() 'This procedure checks if the key field exist already Dim find As String 'declare variable If precord.RecordCount <> 0 Then 'if the recordset is not empty find = txtusern 'set variable with form's field value precord.MoveFirst 'move to first record While Not precord.EOF 'until eof If precord.Fields(0) = find Then 'if the data and field value match txtpassd.SetFocus 'shift focus Exit Sub 'exit End If precord.MoveNext 'move to next record Wend 'repeat MsgBox "No such username.", vbExclamation, "Error" txtusern.SetFocus 'shift focus End If End Sub Private Sub txtpassd_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then Me.cmddelete.SetFocus End If End Sub Private Sub txtpassword_GotFocus() 'This procedure checks if the key field exist already Dim find As String 'declare variable If precord.RecordCount <> 0 Then 'if the recordset is not empty find = txtusername 'set variable with form's field value precord.MoveFirst 'move to first record While Not precord.EOF 'until eof If precord.Fields(0) = find Then 'if the data and field value match MsgBox "This Username exists already.", vbInformation, "Information" txtusername.SetFocus 'shift focus Exit Sub 'exit End If Bishwanath Parajuli 336

Documentation for Easy Library Management System

precord.MoveNext 'move to next record Wend 'repeat End If End Sub Private Sub txtopass_GotFocus() 'This procedure checks if the key field exist already Dim find As String find = txtuser If precord.RecordCount <> 0 Then precord.MoveFirst While Not precord.EOF If precord.Fields(0) = find Then txtopass.SetFocus Exit Sub End If precord.MoveNext Wend MsgBox "No such username.", vbInformation, "Error" txtusername.SetFocus End If End Sub Private Sub txtnpass_GotFocus() 'This procedure checks if the data in the specified field match_ 'with the field of the database Dim find As String find = txtopass If precord.RecordCount <> 0 Then precord.MoveFirst While Not precord.EOF If precord.Fields(0) = Me.txtuser And precord.Fields(2) = find Then txtnpass.SetFocus Exit Sub End If precord.MoveNext Wend MsgBox "Your password doesn't match with that on database.", vbInformation, "Information" txtopass.SetFocus End If End Sub Private Sub txtcpass_LostFocus() 'This procedure compares the data in two fields Bishwanath Parajuli 337

Documentation for Easy Library Management System

If txtnpass <> txtcpass Then 'if texboxes value dont match MsgBox "Your Passwords don't match.", vbInformation, "Error" Exit Sub 'exit End If End Sub Private Sub cmdchngpass_Click() 'This procedure changes data in the specified field of database If txtuser = "" Or txtopass = "" Or txtnpass = "" Or txtcpass = "" Then 'if the textboxes are empty MsgBox "Please, fill the fields.", vbExclamation, "Error" Exit Sub 'exit End If If precord.RecordCount <> 0 Then 'if the recorset is not empty precord.MoveFirst 'move to first record While Not precord.EOF 'until eof If precord.Fields(0) = Me.txtuser And precord.Fields(2) = txtopass Then 'if the data and field value matches 'set the textboxes data as new data into the field precord.Fields(2) = txtnpass.Text precord.Update 'save it Me.txtuser.SetFocus 'shift focus MsgBox "Password updated.", vbInformation, "Update Complete" End If precord.MoveNext 'move to next record Wend 'repeat End If End Sub Sub clearallfields() 'This procedure resets all the fields under a tab txtpassword = "" txtusername = "" txtcpassword = "" cmbusertype.clear 'clear combo cmbusertype.AddItem "Administrator/Head Librarian" cmbusertype.AddItem "General User" 'populate combo End Sub

Bishwanath Parajuli

338

Documentation for Easy Library Management System

Function checklibrarian() As Boolean 'This function checks for redundancy of the data If precord.RecordCount <> 0 Then 'if the recordset is not empty precord.MoveFirst 'move to first record While Not precord.EOF 'until eof If cmbusertype.Text = "Administrator/Head Librarian" Then 'if the data in combo is as specified If precord.Fields(1) = "Administrator/Head Librarian" Then 'and if the field value matches the data checklibrarian = True 'set boolean value to true MsgBox "There is already a Head Librarian. Please delete the librarian if you want to add new.", vbCritical, "Error" Exit Function 'exit ElseIf precord.Fields(1) <> "Administrator/Head Librarian" Then 'and if the field value doesn't match the data checklibrarian = False 'set boolean value to false End If End If precord.MoveNext 'move to next record Wend 'repeat End If End Function Private Sub txtpassword_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then 'if enter is pressed txtcpassword.SetFocus 'shift focus End If End Sub Private Sub txtuser_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then Me.txtopass.SetFocus End If End Sub Private Sub txtusern_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then Me.txtpassd.SetFocus End If End Sub Private Sub txtusername_KeyPress(KeyAscii As Integer) Bishwanath Parajuli 339

Documentation for Easy Library Management System

If KeyAscii = 13 Then cmbusertype.SetFocus End If End Sub

Bishwanath Parajuli

340

Documentation for Easy Library Management System

frmoverview: Private Sub cmblevel_Click() 'This procedure checks the total records having the value 'specified in the combo box, by the user Dim count As Integer 'declare variable If Adodc3.Recordset.RecordCount <> 0 Then 'if the recordset is not empty Adodc3.Recordset.MoveFirst 'move to first record While Not Adodc3.Recordset.EOF 'until eof If Adodc3.Recordset.Fields(5) = cmblevel.Text Then 'compare field value and combo's data and if matched count = count + 1 'increase value of count by 1 End If Adodc3.Recordset.MoveNext 'move to next record Wend 'repeat End If If count <> 0 Then lbltotal.Caption = count 'set the value in label ElseIf count = 0 Then lbltotal.Caption = 0 End If End Sub Private Sub cmdok_Click() Unload Me 'close the form End Sub Private Sub Form_Load() 'This procedure configures ADODC connection 'and calculates the sum of specified field of having connection Dim cost As Integer 'declare variable cost = 0 Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data source = " & App.Path & "\Library Management System.mdb" 'configure provider and application path Adodc1.CommandType = adCmdUnknown Adodc1.RecordSource = "Select * from tblissue" 'specify the data source Adodc1.Refresh 'refresh adodc Adodc2.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data source = " & App.Path & "\Library Management System.mdb" Bishwanath Parajuli 341

Documentation for Easy Library Management System

Adodc2.CommandType = adCmdUnknown Adodc2.RecordSource = "Select * from tblbookdetails" Adodc2.Refresh Adodc3.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data source = " & App.Path & "\Library Management System.mdb" Adodc3.CommandType = adCmdUnknown Adodc3.RecordSource = "Select * from tblmember" Adodc3.Refresh lbltotalissue.Caption = Adodc1.Recordset.RecordCount 'set the value in the label lbltotalbooks.Caption = Adodc2.Recordset.RecordCount lbltotalmem.Caption = Adodc3.Recordset.RecordCount If Adodc2.Recordset.RecordCount <> 0 Then 'if the recorset is not empty Adodc2.Recordset.MoveFirst 'move to first record While Not Adodc2.Recordset.EOF 'until eof cost = Adodc2.Recordset.Fields(8) + cost 'sum up all the data in the specified field Adodc2.Recordset.MoveNext 'move to next record Wend 'repeat End If lblprice.Caption = "Rs. " & cost For i = 1 To 10 cmblevel.AddItem i 'populate the data in combo Next i cmblevel.AddItem "Teachers and Staffs" End Sub Private Sub optlevel_Click() fradet.Visible = False 'show the frame fralevel.Visible = True 'hide the frame End Sub Private Sub optwhole_Click() fradet.Visible = True fralevel.Visible = False End Sub

Bishwanath Parajuli

342

Documentation for Easy Library Management System

frmovmem: Private Sub chklist_Click() If chklist.Value = vbChecked Then 'if checkbox is checked DTPicker.Enabled = True 'enable datpicker lsvmem.ListItems.clear 'clear listview ElseIf chklist.Value = vbUnchecked Then 'if checkbox is unchecked DTPicker.Enabled = False 'disable datpicker DTPicker.Refresh 'refresh it DTPicker.Value = VBA.Date 'set datapicker in system date lsvmem.ListItems.clear Call listdatas 'call function End If End Sub Private Sub DTPicker_Change() 'This procedure compares the data with the date selected 'alters the color of the text 'if the data have value of 9th field less than date selected lsvmem.ListItems.clear 'clear list view If mrecord.RecordCount <> 0 Then 'if recordset is not empty Dim lstitem As ListItem 'declare lstitem as listview's items mrecord.MoveFirst 'move to first record While Not mrecord.EOF 'until eof Set lstitem = lsvmem.ListItems.add(, , mrecord!id) 'set the value of first column header 'add the data into the field from specified recordset lstitem.SubItems(1) = mrecord.Fields(1) lstitem.SubItems(2) = mrecord.Fields(2) lstitem.SubItems(3) = mrecord.Fields(3) lstitem.SubItems(4) = mrecord.Fields(9) If mrecord.Fields(9) < DTPicker Then 'if value of datepicker is less than field's value 'specify the text and font's color lstitem.SubItems(5) = "MEMBERSHIP EXPIRED." lstitem.ForeColor = vbRed lstitem.ListSubItems(1).ForeColor = vbRed lstitem.ListSubItems(2).ForeColor = vbRed lstitem.ListSubItems(3).ForeColor = vbRed lstitem.ListSubItems(4).ForeColor = vbRed lstitem.ListSubItems(5).ForeColor = vbRed Else Bishwanath Parajuli 343

Documentation for Easy Library Management System

lstitem.SubItems(5) = "Valid till today." End If mrecord.MoveNext 'move to next record Wend 'repeat End If End Sub Private Sub Form_Load() 'This procedure configure ADODB Call connection 'call functions Call memeberrecset Call listdatas DTPicker.Enabled = False 'disable datapicker End Sub Sub listdatas() 'This procedure list the data into the list view If mrecord.RecordCount <> 0 Then 'if recordset is not empty Dim lstitem As ListItem 'declare lstitem as listview's items mrecord.MoveFirst 'move to first record While Not mrecord.EOF 'until eof Set lstitem = lsvmem.ListItems.add(, , mrecord!id) 'set the value of first column header 'add the data into the field from specified recordset lstitem.SubItems(1) = mrecord.Fields(1) lstitem.SubItems(2) = mrecord.Fields(2) lstitem.SubItems(3) = mrecord.Fields(3) lstitem.SubItems(4) = mrecord.Fields(9) If mrecord.Fields(9) < VBA.Date Then 'if value of datepicker is less than field's value 'specify the text and font's color lstitem.SubItems(5) = "MEMBERSHIP EXPIRED." lstitem.ForeColor = vbRed lstitem.ListSubItems(1).ForeColor = vbRed lstitem.ListSubItems(2).ForeColor = vbRed lstitem.ListSubItems(3).ForeColor = vbRed lstitem.ListSubItems(4).ForeColor = vbRed lstitem.ListSubItems(5).ForeColor = vbRed Else lstitem.SubItems(5) = "Valid till today." End If mrecord.MoveNext Wend End If End Sub Bishwanath Parajuli 344

Documentation for Easy Library Management System

Private Sub lsvmem_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader) 'This procedure toggles the clicked column's sort order 'only if the active column is clicked If (lsvmem.SortKey = ColumnHeader.Index - 1) Then ColumnHeader.Tag = Not Val(ColumnHeader.Tag) End If 'set sort order to that of the respective ListSortOrderConstants value lsvmem.SortOrder = Abs(Val(ColumnHeader.Tag)) 'get the zero-based index of the clicked column. lsvmem.SortKey = ColumnHeader.Index - 1 'sort the column lsvmem.Sorted = True End Sub

Bishwanath Parajuli

345

Documentation for Easy Library Management System

frmprefer: Private Sub cmdapply_Click() 'This procedure changes the data in the specified field If srecord.RecordCount <> 0 Then 'if recorset is not empty srecord.MoveFirst 'move to first record While Not srecord.EOF 'until eof srecord.Delete 'delete the record srecord.MoveNext 'move to next record Wend 'repeat End If srecord.AddNew 'add new record If Me.chkbook.Value = vbChecked Then 'if checkbox is checked srecord.Fields(0) = "Yes" 'set field value to Yes ElseIf Me.chkbook.Value = vbUnchecked Then 'if checkbox is unchecked srecord.Fields(0) = "No" 'set field value to No End If If Me.chkmem.Value = vbChecked Then srecord.Fields(1) = "Yes" ElseIf Me.chkmem.Value = vbUnchecked Then srecord.Fields(1) = "No" End If If Me.chkcompaq.Value = vbChecked Then srecord.Fields(2) = "Yes" ElseIf Me.chkcompaq.Value = vbUnchecked Then srecord.Fields(2) = "No" End If If Me.chkinform.Value = vbChecked Then srecord.Fields(3) = "Yes" ElseIf Me.chkinform.Value = vbUnchecked Then srecord.Fields(3) = "No" End If If Me.chkcreate.Value = vbChecked Then srecord.Fields(4) = "Yes" ElseIf Me.chkcreate.Value = vbUnchecked Then srecord.Fields(4) = "No" End If srecord.Update 'save the record Unload Me 'close the form End Sub

Bishwanath Parajuli

346

Documentation for Easy Library Management System

Private Sub cmdcancel_Click() Unload Me 'close the form End Sub Private Sub Form_Load() 'This procedure configures ADODB connection 'and configures check boxes according to the value of field Call connection 'call function Call preferrecset If srecord.Fields(0) = "Yes" Then 'if field value to Yes Me.chkbook.Value = vbChecked 'check the checkbox ElseIf srecord.Fields(0) = "No" Then 'if field value to No Me.chkbook.Value = vbUnchecked 'uncheck the checkbox End If If srecord.Fields(1) = "Yes" Then Me.chkmem.Value = vbChecked ElseIf srecord.Fields(1) = "No" Then Me.chkmem.Value = vbUnchecked End If If srecord.Fields(2) = "Yes" Then Me.chkcompaq.Value = vbChecked ElseIf srecord.Fields(2) = "No" Then Me.chkcompaq.Value = vbUnchecked End If If srecord.Fields(3) = "Yes" Then Me.chkinform.Value = vbChecked ElseIf srecord.Fields(3) = "No" Then Me.chkinform.Value = vbUnchecked End If If srecord.Fields(4) = "Yes" Then Me.chkcreate.Value = vbChecked ElseIf srecord.Fields(4) = "No" Then Me.chkcreate.Value = vbUnchecked End If End Sub

Bishwanath Parajuli

347

Documentation for Easy Library Management System

frmpubnauth: Dim code As Integer Private Sub cmbcode_Click() 'This procedure adds item to combobox tabs.Enabled = True 'enable tab control If precord.RecordCount <> 0 Then 'if the record set is not empty precord.MoveFirst 'move to first record While Not precord.EOF 'until eof If precord.Fields(0) = cmbcode Then 'if field value and combo matches lbltitle.Caption = precord.Fields(1) 'set label with the data in field tabs.SetFocus 'shift focus End If precord.MoveNext 'move to next record Wend 'repeat End If End Sub Private Sub cmdauth_Click() cmdauth.Visible = False 'hide object cmdpub.Visible = True 'show object authgrid.Visible = True pubgrid.Visible = False End Sub Private Sub cmdbeginauth_Click() 'This procedure moves pointer to first record On Error GoTo errhandle If bdrecord.BOF = True Then 'if the record pointer is at bof then MsgBox "This is First record", vbInformation, "Information" bdrecord.MoveFirst 'move record pointer to first record Exit Sub ElseIf bdrecord.AbsolutePosition = adPosBOF Then 'if absolute position of the record is at bof then bdrecord.MoveFirst 'move record pointer to last record Exit Sub Else Call viewdataauth 'call the function bdrecord.MoveFirst 'move pointer to first record Bishwanath Parajuli 348

Documentation for Easy Library Management System

End If Exit Sub errhandle: MsgBox Err.Description, vbCritical, "Error" End Sub Private Sub cmdbeginpub_Click() 'This procedure moves pointer to first record On Error GoTo errhandle If brecord.BOF = True Then 'if the record pointer is at bof MsgBox "This is First record", vbInformation, "Information" brecord.MoveFirst 'move record pointer to first record Exit Sub ElseIf brecord.AbsolutePosition = adPosBOF Then 'if absolute position of the record is at bof then brecord.MoveFirst 'move record pointer to last record Exit Sub Else Call viewdatapub 'call the function brecord.MoveFirst 'move pointer to first record End If Exit Sub errhandle: MsgBox Err.Description, vbCritical, "Error" End Sub Private Sub cmdcancel_Click() 'This procedure deletes the space reserved for saving new record 'created during addnew process brecord.CancelUpdate tabs.TabVisible(0) = True 'show the tabs tabs.TabVisible(2) = True Call disable 'call functions Call checkpubrecords End Sub Private Sub cmdcancelauth_Click() 'This procedure deletes the space reserved for saving new record 'created during addnew processbdrecord.CancelUpdate tabs.TabVisible(1) = True 'show the tabs tabs.TabVisible(2) = True Bishwanath Parajuli 349

Documentation for Easy Library Management System

Call disable 'call functions Call checkauthrecords End Sub Private Sub cmddelete_Click() 'This procedure deletes the record from the specified recordset Dim recno As String 'declare variable recno = InputBox("Enter the code or name of the author, you want to delete?", "Delete") 'allow the user to enter the data into inputbox If recno <> "" Then 'if inputbox wasn't empty If bdrecord.RecordCount <> 0 Then 'if the recordset is not empty bdrecord.MoveFirst 'move to first record While Not bdrecord.EOF 'until eof If bdrecord.Fields(0) = recno Or bdrecord.Fields(1) = recno Then 'if field value and the variable match bdrecord.Delete 'delete the record timeauth.Enabled = True 'enable timer Call checkpubrecords 'call functions Call clear MsgBox "Author Deleted.", vbInformation, "Deleted" End If bdrecord.MoveNext 'move to next record Wend 'repeat End If End If End Sub Private Sub cmddeletep_Click() 'This procedure deletes the record from the specified recordset Dim codeno As String 'declare variable codeno = InputBox("Enter the code or name of the publisher, you want to delete?", "Delete") 'allow the user to enter the data into inputbox If codeno <> "" Then 'if inputbox wasn't empty If brecord.RecordCount <> 0 Then 'if the recordset is not empty brecord.MoveFirst 'move to first record While Not brecord.EOF 'until eof If brecord.Fields(0) = codeno Or brecord.Fields(1) = codeno Then 'if field value and the variable match brecord.Delete 'delete the record timepub.Enabled = True 'enable timer Bishwanath Parajuli 350

Documentation for Easy Library Management System

Call checkpubrecords 'call functions MsgBox "Publisher Deleted.", vbInformation, "Deleted" End If brecord.MoveNext 'move to next record Call clear Wend 'repeat End If End If End Sub Private Sub cmdlastauth_Click() 'This procedure moves pointer to last record On Error GoTo errhandle If bdrecord.EOF = True Then 'if record pointer is at eof then MsgBox "This is Last record", vbInformation, "Information" bdrecord.MoveLast 'move record pointer to last record Exit Sub Else Call viewdataauth 'call function bdrecord.MoveLast 'move record pointer to last record End If Exit Sub errhandle: MsgBox Err.Description, vbCritical, "Error" End Sub Private Sub cmdlastpub_Click() 'This procedure moves pointer to last record On Error GoTo errhandle If brecord.EOF = True Then 'if record pointer is at eof then MsgBox "This is Last record", vbInformation, "Information" brecord.MoveLast 'move record pointer to last record Exit Sub Else Call viewdatapub 'call function brecord.MoveLast 'move record pointer to last record End If Exit Sub errhandle: MsgBox Err.Description, vbCritical, "Error" End Sub Bishwanath Parajuli 351

Documentation for Easy Library Management System

Private Sub cmdmodifyauthor_Click() 'This procedure modify's the data related to "author" On Error GoTo errhandle: If bdrecord.RecordCount <> 0 Then 'if the recordset is not empty If MsgBox("Are you sure you want to modify the record?", vbYesNo) = vbYes Then bdrecord.MoveFirst 'move to first record While Not bdrecord.EOF 'until eof If bdrecord.Fields(0) = lblauthid Then 'compare the field and label and if matched 'set label with the data in the textboxes spcified below bdrecord.Fields(1) = txtauthname bdrecord.Fields(2) = txtauthcontact bdrecord.Fields(3) = txtcountry bdrecord.Update 'save the record MsgBox "Record updated.", vbInformation End If bdrecord.MoveNext 'move to next record Wend 'repeat End If End If Exit Sub errhandle: MsgBox Err.Description, vbCritical, "Error" End Sub Private Sub cmdmodifypublisher_Click() 'This procedure modify's the data related to "publisher" On Error GoTo errhandle: If brecord.RecordCount <> 0 Then 'if the recordset is not empty If MsgBox("Are you sure you want to modify the record?", vbYesNo) = vbYes Then brecord.MoveFirst 'move to first record While Not brecord.EOF 'until eof If brecord.Fields(0) = lblauthid Then 'compare the field and label and if matched 'set label with the data in the textboxes spcified below brecord.Fields(1) = txtauthname brecord.Fields(2) = txtauthcontact brecord.Update 'save the record MsgBox "Record updated.", vbInformation End If brecord.MoveNext 'move to next record Bishwanath Parajuli 352

Documentation for Easy Library Management System

Wend 'repeat End If End If Exit Sub errhandle: MsgBox Err.Description, vbCritical, "Error" End Sub Private Sub cmdnewauth_Click() 'This procedure creates space for adding new data 'and creates a value of keyfield On Error GoTo errhandle: Call clear 'call function Call enable If bdrecord.RecordCount = 0 Then 'if the recordset is empty code = 401 'set code = 401 Else bdrecord.MoveLast 'else move to last record code = bdrecord.Fields(0) + 1 'increase code by 1 compared to the last data End If lblauthid = code 'set code in label bdrecord.AddNew 'allow to add new record tabs.TabVisible(1) = False 'hide the tabs tabs.TabVisible(2) = False txtauthname.SetFocus 'shift focus Exit Sub 'exit errhandle: MsgBox Err.Description, vbCritical, "Error" End Sub Private Sub cmdnewauth_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then 'if enter is pressed Me.txtauthname.SetFocus 'shift focus End If End Sub Private Sub cmdnewpub_Click() 'This procedure creates space for adding new data 'and creates a value of keyfield Call clear 'call function If brecord.RecordCount = 0 Then 'if the recordset is empty code = 501 'set code = 401 Else Bishwanath Parajuli 353

Documentation for Easy Library Management System

brecord.MoveLast 'else move to last record code = brecord.Fields(0) + 1 'increase code by 1 compared to the last data End If brecord.AddNew 'allow to add new record lblpubid = code 'set code in label Call enable tabs.TabVisible(0) = False 'hide the tabs tabs.TabVisible(2) = False txtpubname.SetFocus 'shift focus End Sub Private Sub cmdnewpub_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then Me.txtpubname.SetFocus End If End Sub Private Sub cmdnextauth_Click() 'This procedure moves pointer to relative next record On Error GoTo errhandle If bdrecord.AbsolutePosition = adPosBOF Then 'if absolute position of the record is at bof then bdrecord.MoveLast 'move record pointer to last record Exit Sub ElseIf bdrecord.EOF = True Then 'if recordpointer is at eof then MsgBox "This is Last record", vbInformation, "Information" bdrecord.MoveLast 'move to last record Exit Sub Else Call viewdataauth 'call function bdrecord.MoveNext 'move record pointer to next record End If Exit Sub errhandle: MsgBox Err.Description, vbCritical, "Error" End Sub Private Sub cmdnextpub_Click() 'This procedure moves pointer to relative next record On Error GoTo errhandle If brecord.AbsolutePosition = adPosBOF Then 'if absolute position of the record is at bof then brecord.MoveLast 'move record pointer to last record Bishwanath Parajuli 354

Documentation for Easy Library Management System

Exit Sub ElseIf brecord.EOF = True Then 'if recordpointer is at eof then MsgBox "This is Last record", vbInformation, "Information" brecord.MoveLast 'move to last record Exit Sub Else Call viewdatapub 'call function brecord.MoveNext 'move record pointer to next record End If Exit Sub errhandle: MsgBox Err.Description, vbCritical, "Error" End Sub Private Sub cmdpreviousauth_Click() 'This procedure moves pointer to relative previous record On Error GoTo errhandle If bdrecord.AbsolutePosition = adPosEOF Then 'if record pointer is at eof then bdrecord.MoveFirst 'move record pointer to first record Exit Sub ElseIf bdrecord.BOF = True Then 'if record pointer is at bof MsgBox "This is First record", vbInformation, "Information" bdrecord.MoveFirst 'move to first record Exit Sub Else Call viewdataauth 'call function bdrecord.MovePrevious 'move record pointer to previous record End If Exit Sub errhandle: MsgBox Err.Description, vbCritical, "Error" End Sub Private Sub cmdpreviouspub_Click() 'This procedure moves pointer to relative previous record On Error GoTo errhandle If brecord.AbsolutePosition = adPosEOF Then 'if record pointer is at eof then brecord.MoveFirst 'move record pointer to first record Exit Sub Bishwanath Parajuli 355

Documentation for Easy Library Management System

ElseIf brecord.BOF = True Then 'if record pointer is at bof MsgBox "This is First record", vbInformation, "Information" brecord.MoveFirst 'move to first record Exit Sub Else Call viewdatapub 'call function brecord.MovePrevious 'move record pointer to previous record End If Exit Sub errhandle: MsgBox Err.Description, vbCritical, "Error" End Sub Private Sub cmdpub_Click() 'show/hide controls cmdauth.Visible = True cmdpub.Visible = False authgrid.Visible = False pubgrid.Visible = True End Sub Private Sub cmdsaveauth_Click() 'This procedure saves the specified data into the database On Error GoTo errhandle: If cmbcode.Text = "" Or txtauthname = "" Or txtcountry = "" Then 'if the combo, textboxes are empty MsgBox "Please enter all the fields.", vbExclamation, "Error" Exit Sub 'exit End If 'set the value of label into field bdrecord.Fields(0) = lblauthid bdrecord.Fields(1) = txtauthname bdrecord.Fields(2) = txtauthcontact bdrecord.Fields(3) = txtcountry bdrecord.Fields(4) = Int(cmbcode.Text) bdrecord.Update 'save the record timeauth.Enabled = True 'enable timer MsgBox "New Author Saved.", vbInformation, "Library Management" Call clear 'call function Call disable Bishwanath Parajuli 356

Documentation for Easy Library Management System

tabs.TabVisible(1) = True 'show tabs tabs.TabVisible(2) = True Call checkauthrecords cmdnewauth.SetFocus 'shift focus Exit Sub errhandle: MsgBox Err.Description, vbCritical, "" End Sub Private Sub cmdsavepub_Click() 'This procedure saves the specified data into the database If txtpubname = "" Or txtpubcontact = "" Or cmbcode.Text = "" Then 'if the combo, textboxes are empty MsgBox "Please enter all the fields.", vbExclamation, "Error" Exit Sub 'exit End If 'set the value of label into field brecord.Fields(0) = lblpubid brecord.Fields(1) = txtpubname brecord.Fields(2) = txtpubcontact brecord.Fields(3) = cmbcode.Text brecord.Update 'save the record timepub.Enabled = True 'enable timer MsgBox "New Publisher Saved.", vbInformation, "Library Management" Call clear 'call function Call disable Call checkpubrecords tabs.TabVisible(0) = True 'show tabs tabs.TabVisible(2) = True cmdnewpub.SetFocus 'shift focus End Sub Private Sub Form_Load() 'This procedure configures ADODC and ADODB connection Call connection 'call function Call author Call publisher Call bookrecset Call checkauthrecords Call checkpubrecords Call cmbbookid

Bishwanath Parajuli

357

Documentation for Easy Library Management System

adoauth.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data source = " & App.Path & "\Library Management System.mdb" 'configure provider and application path adoauth.CommandType = adCmdUnknown adoauth.RecordSource = "select * from tblauthor" 'specify the recordsource adoauth.Refresh 'refresh adodc adopub.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data source = " & App.Path & "\Library Management System.mdb" adopub.CommandType = adCmdUnknown adopub.RecordSource = "select * from tblpublisher" adopub.Refresh pubgrid.Columns(0).Locked = True 'lock columns of datagrid authgrid.Columns(0).Locked = True Call disable End Sub Sub clear() 'This procedure resets the fields txtauthname = "" txtauthcontact = "" txtpubname = "" txtpubcontact = "" txtcountry = "" End Sub Sub cmbbookid() 'This procedure adds the item to combobox If precord.RecordCount <> 0 Then 'if the recordset is not empty precord.MoveFirst 'move to first record While Not precord.EOF 'until eof cmbcode.AddItem (precord.Fields(0)) 'populate combo precord.MoveNext 'move to next record Wend 'repeat End If End Sub Private Sub tabs_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then 'if enter is pressed If tabs.Caption = "Author Details" Then 'if the tabs caption is as specified Me.cmdnewauth.SetFocus 'shift focus Bishwanath Parajuli 358

Documentation for Easy Library Management System

ElseIf tabs.Caption = "Publisher Details" Then Me.cmdnewpub.SetFocus End If End If End Sub Private Sub timeauth_Timer() 'This procedure refreshes the datagrid adoauth.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data source = " & App.Path & "\Library Management System.mdb" 'configure provider and application path adoauth.CommandType = adCmdUnknown adoauth.RecordSource = "select * from tblauthor" 'specify the record source adoauth.Refresh 'refresh adodc and datagrid authgrid.Refresh timeauth.Enabled = False 'disable timer Call disable 'call function pubgrid.Columns(0).Locked = True 'lock the columns of datagrid authgrid.Columns(0).Locked = True End Sub Private Sub timepub_Timer() 'This procedure refreshes the datagrid adopub.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data source = " & App.Path & "\Library Management System.mdb" adopub.CommandType = adCmdUnknown adopub.RecordSource = "select * from tblpublisher" adopub.Refresh pubgrid.Refresh timepub.Enabled = False Call disable pubgrid.Columns(0).Locked = True authgrid.Columns(0).Locked = True End Sub Private Sub txtauthcontact_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then 'if enter is pressed txtcountry.SetFocus 'shift focus End If End Sub Private Sub txtauthname_KeyPress(KeyAscii As Integer) Bishwanath Parajuli 359

Documentation for Easy Library Management System

If KeyAscii = 13 Then txtauthcontact.SetFocus End If End Sub Private Sub txtauthname_LostFocus() 'This procedure checks if the record exist already On Error GoTo errhandle: If bdrecord.RecordCount <> 0 Then 'if the recordset is not empty If cmdnewauth.Enabled = False Then 'if the command button is disabled bdrecord.CancelUpdate 'cancel the addnew process bdrecord.MoveFirst 'move to first record While Not bdrecord.EOF 'until eof If bdrecord.Fields(1) = txtauthname.Text _ And bdrecord.Fields(4) = cmbcode.Text Then 'if recordset's field and form field match MsgBox "Record already existed.", vbExclamation cmdsaveauth.Enabled = False 'disable button Exit Sub Else cmdsaveauth.Enabled = True 'enable button End If bdrecord.MoveNext 'move to next record Wend 'repeat bdrecord.AddNew 'continue to ADD NEW record End If End If Exit Sub errhandle: MsgBox Err.Description, vbCritical End Sub Private Sub txtpubname_LostFocus() 'This procedure checks if the record exist already If brecord.RecordCount <> 0 Then If cmdnewpub.Enabled = False Then brecord.CancelUpdate 'CANCEL the addnew process brecord.MoveFirst While Not brecord.EOF ' If brecord.Fields(3) = cmbcode.Text And brecord.Fields(1) = txtpubname Then MsgBox "Record already existed.", vbExclamation cmdsavepub.Enabled = False Exit Sub Bishwanath Parajuli 360

Documentation for Easy Library Management System

Else cmdsavepub.Enabled = True End If brecord.MoveNext Wend brecord.AddNew 'continue to ADD NEW record End If End If End Sub Sub disable() 'This procedure configures the controls cmdnewauth.Enabled = True cmdsaveauth.Enabled = False cmddelete.Enabled = True cmdcancelauth.Enabled = False Me.cmdmodifyauthor.Enabled = True Me.cmdnewpub.Enabled = True Me.cmdsavepub.Enabled = False Me.cmddeletep.Enabled = True Me.cmdmodifypublisher.Enabled = True Me.cmdcancel.Enabled = False End Sub Sub enable() 'This procedure configures the controls cmdnewauth.Enabled = False cmdsaveauth.Enabled = True Me.cmdmodifyauthor.Enabled = False cmddelete.Enabled = False cmdcancelauth.Enabled = True Me.cmdnewpub.Enabled = False Me.cmdsavepub.Enabled = True Me.cmdmodifypublisher.Enabled = False Me.cmddeletep.Enabled = False Me.cmdcancel.Enabled = True End Sub Private Sub txtcountry_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then 'if enter is pressed cmdsaveauth.SetFocus 'shift focus End If End Sub Private Sub txtpubcontact_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then Bishwanath Parajuli 361

Documentation for Easy Library Management System

If txtpubcontact <> "" Then 'if the textbox is not empty If InStr(1, txtpubcontact, "www.") Or InStr(1, txtpubcontact, ".com") Then 'if the text box contains www. or .com Else txtpubcontact = "www." & txtpubcontact & ".com" End If End If End If End Sub Private Sub txtpubname_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then 'if enter is pressed txtpubcontact.SetFocus 'shift focus End If End Sub Sub viewdataauth() 'This procedure sets the value of fields from database into_ 'specified form fields lblauthid = bdrecord.Fields(0) txtauthname = bdrecord.Fields(1) txtauthcontact = bdrecord.Fields(2) cmbcode.Text = bdrecord.Fields(4) If precord.RecordCount <> 0 Then 'if recordset is not empty precord.MoveFirst 'move to first record While Not precord.EOF 'until eof If precord.Fields(0) = cmbcode.Text Then 'if field and combo value match lbltitle.Caption = precord.Fields(1) 'set the field value into label End If precord.MoveNext 'move to next record Wend 'repeat End If txtcountry = bdrecord.Fields(3) End Sub Sub viewdatapub() 'This procedure sets the value of fields from database into_ 'specified form fields lblpubid = brecord.Fields(0) txtpubname = brecord.Fields(1) txtpubcontact = bdrecord.Fields(2) Bishwanath Parajuli 362

Documentation for Easy Library Management System

cmbcode.Text = brecord.Fields(3) If precord.RecordCount <> 0 Then precord.MoveFirst While Not precord.EOF If precord.Fields(0) = cmbcode.Text Then lbltitle.Caption = precord.Fields(1) End If precord.MoveNext Wend End If End Sub Sub checkauthrecords() 'This procedure enables/disables navigation buttons If bdrecord.RecordCount = 0 Then 'if the recordset is empty franavigateauth.Enabled = False 'disable the frame Else franavigateauth.Enabled = True End If End Sub Sub checkpubrecords() 'This procedure enables/disables navigation buttons If brecord.RecordCount = 0 Then franavigatepub.Enabled = False Else franavigatepub.Enabled = True End If End Sub

Bishwanath Parajuli

363

Documentation for Easy Library Management System

frmreminders: Private Sub Form_Load() 'This procedure configures ADODB and add data into listiew Call connection 'call function Call qryissuerecset On Error GoTo errhandle: Dim lstitem As ListItem 'declare lstitem as listview's items If bdrecord.RecordCount <> 0 Then 'if recordset is not empty bdrecord.MoveFirst 'move to first record While Not bdrecord.EOF 'until eof If VBA.Date > bdrecord.Fields(5) Then 'if the field value is less than system date Set lstitem = lstview.ListItems.add(, , bdrecord!Title) 'set the value of first column header lstitem.SubItems(1) = bdrecord.Fields(3) 'set the subitem of the list view End If bdrecord.MoveNext 'move to next record Wend 'repeat End If Exit Sub errhandle: MsgBox Err.Description, vbCritical, "Error" End Sub Private Sub lstview_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader) 'This procedure toggles the clicked column's sort order 'only if the active column is clicked If (lstview.SortKey = ColumnHeader.Index - 1) Then ColumnHeader.Tag = Not Val(ColumnHeader.Tag) End If 'set sort order to that of the respective ListSortOrderConstants value lstview.SortOrder = Abs(Val(ColumnHeader.Tag)) 'set the zero-based index of the clicked column. lstview.SortKey = ColumnHeader.Index - 1 'sort the column lstview.Sorted = True End Sub

Bishwanath Parajuli

364

Documentation for Easy Library Management System

frmreserve: Dim check As Boolean Private Sub chkdet_Click() If chkdet.Value = vbChecked Then 'if the checkbox is checked Me.Height = 6720 'set the height of the window ElseIf chkdet.Value = vbUnchecked Then 'if the checkbox is unchecked Me.Height = 2835 End If End Sub Private Sub cmbbcode_Click() 'This procedure displays the details of the data linked_ 'with the item clicked in the box 'and checks if the "book is avialable" Dim count, countissue As Integer 'declare variables count = 0 countissue = 0 If precord.RecordCount <> 0 Then 'if the recordset is not empty precord.MoveFirst 'move to the first record While Not precord.EOF 'until end of file If precord.Fields(0) = cmbbcode Then If precord.Fields(3) = "Reference" Then 'if the field has the value specified above cmdreserve.Enabled = False 'disable command buttons cmbsid.Enabled = False MsgBox "Reserving a reference book is prohibited.", vbCritical, "Error" Exit Sub 'exit Else cmbsid.Enabled = True 'enable command buttons End If lbltitle.Caption = precord.Fields(1) 'set caption in label from record field End If precord.MoveNext 'move to next record Wend 'repeat End If If precord.RecordCount <> 0 Then Bishwanath Parajuli 365

Documentation for Easy Library Management System

precord.MoveFirst While Not precord.EOF If precord.Fields(0) = cmbbcode Then 'if the field and combo match 'set the value of field in the variable count count = precord.Fields(4) End If precord.MoveNext Wend End If If bdrecord.RecordCount <> 0 Then bdrecord.MoveFirst While Not bdrecord.EOF If bdrecord.Fields(1) = cmbbcode Then 'if the field data and combo match countissue = countissue + 1 'increase the value of count by 1 End If bdrecord.MoveNext Wend End If If count - countissue > 0 Then 'if the difference is less than 0 MsgBox "This book is available.", vbInformation, "Reservation" Exit Sub End If End Sub Private Sub cmbbcode_GotFocus() cmbsid.Enabled = True 'enable button End Sub Private Sub cmbbcode_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then 'if enter is pressed cmbsid.SetFocus 'shift focus End If End Sub Private Sub cmbsid_Click() 'This procedure displays the details of the data linked_ 'with the item clicked in the box If mrecord.RecordCount <> 0 Then 'if the recordset is not empty Bishwanath Parajuli 366

Documentation for Easy Library Management System

mrecord.MoveFirst 'move to first record While Not mrecord.EOF 'until end of file If mrecord.Fields(0) = Int(cmbsid) Then 'if the field data and combo data match lblname.Caption = mrecord.Fields(1) & " " & mrecord.Fields(3) 'set the caption in label from record field End If mrecord.MoveNext 'move to next record Wend 'repeat End If Call borrower_check 'call functions Call fine_check Call mem_check End Sub Private Sub cmbsid_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then 'if enter is pressed cmdreserve.SetFocus 'shift focus End If End Sub Private Sub cmdbook_Click() cmdreserved.Visible = True 'show the object cmdbook.Visible = False 'hide the object reservegrid.Visible = False bookgrid.Visible = True End Sub Private Sub cmdcancelres_Click() 'This procedure deletes the record from the table If cmbbcode.Text = "" Or cmbsid.Text = "" Then 'if the combo is empty MsgBox "Select the book and member ID to cancel reservation.", vbExclamation, "Error" Exit Sub 'exit End If If lrecord.RecordCount <> 0 Then 'if the recordset is not empty lrecord.MoveFirst 'move to first record While Not lrecord.EOF 'until eof If lrecord.Fields(1) = cmbbcode.Text And lrecord.Fields(2) = Int(cmbsid.Text) Then 'if the field data and combo data match If MsgBox("Do you want to cancel this reservation?", vbYesNo + vbQuestion, "Cancel Reservation") = vbYes Then Bishwanath Parajuli 367

Documentation for Easy Library Management System

lrecord.Delete 'delete the record timereserve.Enabled = True 'enable timer MsgBox "Reservation Cancelled.", vbInformation, "Reserve" Exit Sub 'exit Else MsgBox "Reservation cancellation was interrupted before completion.", vbInformation, "Reserve" End If Exit Sub End If lrecord.MoveNext 'move to next record Wend 'repeat End If End Sub Private Sub cmdreserve_Click() 'This procedure adds new record, specifys the value of key field 'and save it Dim code As Integer 'declare variable If cmbbcode.Text = "" Or cmbsid.Text = "" Then 'if the combo is empty MsgBox "Select the IDs.", vbExclamation, "Reservation" Exit Sub 'exit End If If lrecord.RecordCount = 0 Then 'if the recordset is empty code = 601 'set code = 601 Else lrecord.MoveLast 'move to last record code = lrecord.Fields(0) + 1 'set code 1 more than the value of keyfield of last record End If check = True 'set boolean value as true check = check_issue() 'retrive the value of booelan from specified function If check = True Then 'if the boolean value is true Call borrower_check 'call the functions Call fine_check Call mem_check lrecord.AddNew 'allow to addnew record 'set the specified value in corresponding fields lrecord.Fields(0) = code lrecord.Fields(1) = Val(cmbbcode.Text) Bishwanath Parajuli 368

Documentation for Easy Library Management System

lrecord.Fields(2) = Val(cmbsid.Text) lrecord.Fields(3) = lbldaters.Caption lrecord.Fields(4) = lbldatersc.Caption lrecord.Update 'save the data MsgBox lbltitle & " is reserved.", vbInformation, "Reservation" timereserve.Enabled = True 'enable timer cmdreserve.Enabled = False 'disable buttons cmbsid.Enabled = False Me.cmbbcode.SetFocus 'shift focus to combo End If End Sub Private Sub cmdreserved_Click() cmdreserved.Visible = False 'hide control cmdbook.Visible = Truel 'show control reservegrid.Visible = True bookgrid.Visible = False End Sub Private Sub Form_Load() 'This procedure configures ADODC and ADODB connection Call connection 'call functions Call reserverecset Call bookrecset Call memeberrecset Call issuerecset adobook.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data source = " & App.Path & "\Library Management System.mdb" 'configure provider and application path adobook.CommandType = adCmdUnknown 'select command type adobook.RecordSource = "Select * from tblbookdetails" 'specify the record source adobook.Refresh 'refresh adodc adoreserve.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data source = " & App.Path & "\Library Management System.mdb" adoreserve.CommandType = adCmdUnknown adoreserve.RecordSource = "Select * from tblreserve" adoreserve.Refresh lbldaters.Caption = VBA.Date Bishwanath Parajuli 369

Documentation for Easy Library Management System

'set system date in the label lbldatersc.Caption = VBA.Date + Day(4) 'set a date 4 days ahead of system date in the label Call cmbid 'call function End Sub Sub cmbid() 'This procedure adds item to combobox If mrecord.RecordCount <> 0 Then 'if the recordset is not empty mrecord.MoveFirst 'move to first record While Not mrecord.EOF 'until eof cmbsid.AddItem (mrecord.Fields(0)) 'populate the combo mrecord.MoveNext 'move to next record Wend 'repeat End If If Me.adobook.Recordset.RecordCount <> 0 Then adobook.Recordset.MoveFirst While Not Me.adobook.Recordset.EOF cmbbcode.AddItem (adobook.Recordset.Fields(0)) adobook.Recordset.MoveNext Wend End If End Sub Sub borrower_check() 'This procedure checks "reserve status of borrower" Dim a, countn As Integer 'declare variable countn = 0 a=0 If lrecord.RecordCount <> 0 Then 'if the recordset is not empty lrecord.MoveFirst 'move to first record While Not lrecord.EOF 'until eof If lrecord.Fields(2) = Int(cmbsid.Text) Then 'if the field value and combo value match countn = countn + 1 'increase the value of countn by 1 End If lrecord.MoveNext 'move to next record Wend 'repeat End If

Bishwanath Parajuli

370

Documentation for Easy Library Management System

If lrecord.RecordCount <> 0 Then lrecord.MoveFirst While Not lrecord.EOF If lrecord.Fields(1) = cmbbcode.Text And lrecord.Fields(2) = Int(cmbsid.Text) Then 'if the field value and combo value match a=a+1 'increase the value of a by 1 End If lrecord.MoveNext Wend End If If countn >= 3 Then 'if the value of countn is greater and equal to 3 MsgBox "This borrower has already reserved 3 books. Reservation cannot be continued.", vbExclamation, "Reserve" cmdreserve.Enabled = False 'disable control Exit Sub ElseIf countn < 3 Then 'if the value of countn is less than 3 cmdreserve.Enabled = True 'enable control End If If a >= 1 Then MsgBox "A borrower cannot reserve two same book at a time.", vbInformation, "Reservation" cmdreserve.Enabled = False Exit Sub ElseIf a < 1 Then cmdreserve.Enabled = True End If End Sub Sub mem_check() 'This procedure checks "account status of borrower" If mrecord.RecordCount <> 0 Then 'if the recordset is not empty mrecord.MoveFirst 'move to first record While Not mrecord.EOF 'until eof If mrecord.Fields(0) = Int(cmbsid.Text) Then 'compare the value of field and combo and if matched If mrecord.Fields(9) < VBA.Date Then 'if the value of system date is greater than field value cmdreserve.Enabled = False 'disable button

Bishwanath Parajuli

371

Documentation for Easy Library Management System

If MsgBox("Memebership has expired. Do you want to renew membership?", vbCritical + vbYesNo, "Error") = vbYes Then frmborrowerdetails.display 'call the function related to frmborrowerdetails frmborrowerdetails.Show 'show frmborrowerdetails Me.Hide 'hide the form Exit Sub 'exit Else MsgBox "Reservation Failed.", vbCritical, "Error" End If Exit Sub End If End If mrecord.MoveNext 'move to next record Wend 'repeat End If End Sub Sub fine_check() 'This procedure checks "due status of borrower" If bdrecord.RecordCount <> 0 Then 'if the recordset is not empty bdrecord.MoveFirst 'move to first record While Not bdrecord.EOF 'until eof If bdrecord.Fields(2) = Int(cmbsid) Then 'if field value and combo value match If bdrecord.Fields(4) < VBA.Date Then 'if field value is less than system date cmdreserve.Enabled = False 'disable object If MsgBox("This borrower has fine to pay. Do you want to fine him/her?.", vbYesNo, "Issue") = vbYes Then Me.Hide 'hide form frmrnunreturn.Show 'show frmrnunreturn frmrnunreturn.cmdrenew.Enabled = False 'disable object frmrnunreturn.cmdreturn.Enabled = False Exit Sub 'exit Else MsgBox "This borrower can reserve no more books.", vbExclamation, "Error" End If Exit Sub End If End If bdrecord.MoveNext 'move to next record Bishwanath Parajuli 372

Documentation for Easy Library Management System

Wend 'repeat End If End Sub Function check_issue() As Boolean 'This procedure if the record exist in the next recordset If bdrecord.RecordCount <> 0 Then 'if the recordset is not empty bdrecord.MoveFirst 'move to first record While Not bdrecord.EOF 'until eof If bdrecord.Fields(1) = Me.cmbbcode And bdrecord.Fields(2) = Me.cmbsid Then 'match combo value and field value check_issue = False 'set the value of boolean to false MsgBox "This book has already been issued by the reserver.", vbExclamation, "Reservation" Exit Function 'exit Else check_issue = True 'set the boolean value to true End If bdrecord.MoveNext 'move to next record Wend 'repeat End If End Function Private Sub timereserve_Timer() 'This procedure refreshes the datagrid reservegrid.Refresh 'refresh grid adoreserve.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data source = " & App.Path & "\Library Management System.mdb" 'configure provider and application path adoreserve.CommandType = adCmdUnknown adoreserve.RecordSource = "Select * from tblreserve" 'specify the record source adoreserve.Refresh 'refresh adodc reservegrid.Refresh timereserve.Enabled = False 'disable timer End Sub

Bishwanath Parajuli

373

Documentation for Easy Library Management System

frmrnunreturn: Dim find As Integer 'declare variables Dim idcheck As Boolean Private Sub chkdetails_Click() If chkdetails.Value = vbChecked Then 'if the checkbox is checked Me.Height = 7420 'set the value of the window height ElseIf chkdetails.Value = vbUnchecked Then 'if the checkbox is unchecked Me.Height = 2645 End If End Sub Private Sub cmbbrid_Click() 'This procedure displays the details of the data linked_ 'with the item clicked in the box On Error GoTo errhandler: If mrecord.RecordCount <> 0 Then 'if the recordset is not empty mrecord.MoveFirst 'move to first record While Not mrecord.EOF 'until eof If mrecord.Fields(0) = cmbbrid.Text Then 'if the field value and combo value match 'set the data from field into label lblfname.Caption = mrecord.Fields(1) lblmname.Caption = mrecord.Fields(2) lblsname.Caption = mrecord.Fields(3) lblcontact.Caption = mrecord.Fields(6) lblexpiry.Caption = mrecord.Fields(9) imgpic = LoadPicture(App.Path & "/" & mrecord.Fields(10)) 'load image End If mrecord.MoveNext 'move to next record Wend 'repeat End If Call check_expire 'call function Exit Sub 'exit errhandler: MsgBox Err.Description, vbCritical, "Error" End Sub Private Sub cmbbrid_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then 'if enter is pressed Bishwanath Parajuli 374

Documentation for Easy Library Management System

Me.cmbcode.SetFocus 'shift focus End If End Sub Private Sub cmbcode_Click() 'This procedure displays the details of the data linked_ 'with the item clicked in the box On Error GoTo errhandle Dim lstitem As ListItem 'declare lstitem as listview's items If precord.RecordCount <> 0 Then 'if the recordset is not empty precord.MoveFirst 'move to first record While Not precord.EOF 'until eof If precord.Fields(0) = cmbcode.Text Then 'if the field value and combo value match lbltitle.Caption = precord.Fields(1) 'set the field value into label caption End If precord.MoveNext 'move to next record Wend 'repeat End If Call list 'call function Exit Sub 'exit errhandle: MsgBox Err.Description, vbCritical, "Error" End Sub Private Sub cmbcode_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then 'if enter is pressed If Me.cmdrenew.Visible = True Then 'if the specified command button is visible cmdrenew.SetFocus 'shift focus ElseIf Me.cmdreturn.Visible = True Then cmdreturn.SetFocus End If End If End Sub Private Sub cmdcollect_Click() 'This procedure adds new record, specifys key field and saves it Dim code As Integer 'declare variable If brecord.RecordCount = 0 Then 'if the recordset is empty code = 11 'set specified code value Else Bishwanath Parajuli 375

Documentation for Easy Library Management System

brecord.MoveLast 'move to last record code = brecord.Fields(0) + 1 'increase the value of code by 1 compared to the last record End If If lblfine.Caption <> "" Then 'if the label is not empty brecord.AddNew 'allow to add new record 'set the data into specified field of record source brecord.Fields(0) = code brecord.Fields(1) = cmbcode brecord.Fields(2) = cmbbrid.Text brecord.Fields(3) = lbloverdate.Caption brecord.Fields(4) = lblfine brecord.Update 'save the data End If If bdrecord.RecordCount <> 0 Then 'if the recordset is not empty bdrecord.MoveFirst 'move to first record While Not bdrecord.EOF 'until eof If bdrecord.Fields(1) = cmbcode.Text And bdrecord.Fields(2) = cmbbrid.Text Then 'if the combo's content and field value match If MsgBox("This book has crossed its due date.Do you want to fine it?", vbExclamation + vbYesNo, "Fine") = vbYes Then bdrecord.Delete 'DELETE the record Call history 'call the fucntion cmdrenew.Enabled = True 'enable control cmdreturn.Enabled = True MsgBox "Book ready for issuing.", vbInformation, "Fine" Call restructure 'call the fucntion End If End If bdrecord.MoveNext 'move to next record Wend 'repeat End If End Sub Private Sub cmdrenew_Click() 'This procedure changes the existing record Dim find As Integer idcheck = False 'set the boolean value to false

Bishwanath Parajuli

376

Documentation for Easy Library Management System

idcheck = checkid() 'find the value of boolean by comparing with the function If idcheck = False Then 'if the function returns with value false then If bdrecord.RecordCount <> 0 Then 'if the recordset is not empty bdrecord.MoveFirst 'move to first record While Not bdrecord.EOF 'until eof If bdrecord.Fields(1) = cmbcode.Text And bdrecord.Fields(2) = cmbbrid.Text Then 'if the combo's content and field value match If bdrecord.Fields(7) = "Fiction" Then 'if the field value is as specified bdrecord.Fields(4) = VBA.Date + Day(14) 'set the value of field 14 days ahead of system date bdrecord.Update 'save the data ElseIf bdrecord.Fields(7) = "Non Fiction" Then bdrecord.Fields(4) = VBA.Date + Day(7) bdrecord.Update ElseIf bdrecord.Fields(7) = "Periodical" Then bdrecord.Fields(4) = VBA.Date + Day(7) bdrecord.Update End If Call list 'call the function MsgBox "Book Renewed Sucessfully.", vbInformation, "Renew" cmbbrid.SetFocus 'shift focus Exit Sub 'exit End If bdrecord.MoveNext 'move to next record Wend 'repeat End If End If End Sub Private Sub cmdreturn_Click() 'This procedure deletes the record idcheck = False 'set the boolean value to false idcheck = checkid() 'find the value of boolean by comparing with the function If idcheck = False Then 'if the function returns with value false then If bdrecord.RecordCount <> 0 Then 'if the recordset is not empty bdrecord.MoveFirst 'move to first record While Not bdrecord.EOF 'until eof Bishwanath Parajuli 377

Documentation for Easy Library Management System

If bdrecord.Fields(1) = Val(cmbcode) And bdrecord.Fields(2) = cmbbrid.Text Then 'if the combo's content and field value match If MsgBox("Are you sure you have received the book?", vbInformation + vbYesNo, "Return") = vbYes Then bdrecord.Delete 'delete the record Call history 'call function MsgBox "Book Returning process Completed.", vbInformation, "Information" cmbbrid.SetFocus 'shift focus Else MsgBox "Return is cancelled.", vbInformation, "Error" cmbbrid.SetFocus Exit Sub End If End If bdrecord.MoveNext 'move to next record Wend 'repeat End If End If End Sub Private Sub Form_KeyPress(KeyAscii As Integer) If KeyPress = 27 Then 'if delete is pressed frmlinker.Show 'show form End If End Sub Private Sub Form_Load() 'This procedure configures ADODB and adds item into combo box Call connection 'call functions Call memeberrecset Call bookrecset Call reserverecset Call issuerecset Call restructure Call historyrecset Call finerecset cmbbrid.clear 'clear the combo If mrecord.RecordCount <> 0 Then 'if the recordset is not empty mrecord.MoveFirst 'move to first record While Not mrecord.EOF 'until eof Bishwanath Parajuli 378

Documentation for Easy Library Management System

cmbbrid.AddItem mrecord.Fields(0) 'populate combo mrecord.MoveNext 'move to next record Wend 'repeat End If cmbcode.clear If precord.RecordCount <> 0 Then precord.MoveFirst While Not precord.EOF cmbcode.AddItem precord.Fields(0) precord.MoveNext Wend End If End Sub Function checkid() As Boolean 'This procedure checks for "current status of borrower" If cmdrenew.Visible = True And cmdreturn.Visible = False Then 'if the specified control is visible If lrecord.RecordCount <> 0 Then 'if the recordset is not empty lrecord.MoveFirst 'move to first record While Not lrecord.EOF 'until eof If lrecord.Fields(1) = cmbcode Then 'if the field value and the combo content match MsgBox "This book has been reserved. Renew cannot continue", vbExclamation, "Reserved" checkid = True 'set boolean value to true cmdrenew.Enabled = False 'disable command button Exit Function 'exit Else cmdrenew.Enabled = True 'enable command button End If lrecord.MoveNext 'move to next record Wend 'repeat End If End If If bdrecord.RecordCount <> 0 Then bdrecord.MoveFirst While Not bdrecord.EOF If bdrecord.Fields(1) = Val(cmbcode.Text) And bdrecord.Fields(2) = cmbbrid.Text Then Bishwanath Parajuli 379

Documentation for Easy Library Management System

Call finecalc 'call the function If bdrecord.Fields(4) < VBA.Date Then 'if the field value is older than system date checkid = True 'set boolean value to true If MsgBox("This borrower has fine of Rs. " & lblfine.Caption & " .Do you want to Fine him/her?", vbExclamation + vbYesNo, "Renew/Return") = vbYes Then cmdreturn.Enabled = False 'disable objects cmdrenew.Enabled = False Call structure 'call function Exit Function 'exit Else cmdrenew.Enabled = False cmdreturn.Enabled = False MsgBox "Renew/return process cannot not be completed", vbCritical, "Renew/Return" Exit Function End If Else cmdrenew.Enabled = True 'enable objects cmdreturn.Enabled = True End If Exit Function End If bdrecord.MoveNext 'move to next record Wend 'repeat End If End Function Sub check_expire() 'This procedure checks for "memebership expiry" If mrecord.RecordCount <> 0 Then 'if the recordset is not empty mrecord.MoveFirst 'move to first record While Not mrecord.EOF 'until eof If mrecord.Fields(0) = cmbbrid.Text Then 'if the field value and the combo content match If mrecord.Fields(9) < VBA.Date Then 'if the field value is older than system date cmdreturn.Enabled = False 'disable controls cmdrenew.Enabled = False If MsgBox("Memebership has expired. Do you want to renew membership?", vbCritical + vbYesNo, "Error") = vbYes Then Me.Hide 'hide the form frmborrowerdetails.Show 'show form Bishwanath Parajuli 380

Documentation for Easy Library Management System

frmborrowerdetails.display 'call the form's function Else MsgBox "Returning/Renewing process couldnot be completed", vbCritical, "Error" End If Exit Sub 'exit Else cmdreturn.Enabled = True 'enable objects cmdrenew.Enabled = True Exit Sub End If End If mrecord.MoveNext 'move to next record Wend 'repeat End If End Sub Sub restructure() 'This procedure resizes the form frafine.Visible = False 'hide objects imgexc.Visible = False frmrnunreturn.frabook.Left = 2280 'set window width End Sub Sub structure() 'This procedure resizes the form imgexc.Visible = True 'show objects frafine.Visible = True frabook.Left = 120 'set window width End Sub Sub finecalc() 'This procedure manipulates difference between "date of issue" and system date Dim X, Y As String 'declare variables Dim dater As Date dater = bdrecord.Fields(4) 'set variable with system date X = (Year(dater) * 365) + (Month(dater) * 30) + Day(dater) Y = (Year(VBA.Date) * 365) + (Month(VBA.Date) * 30) + Day(VBA.Date) 'convert the system date and date in field to numerical form Select Case (Y - X) 'calculate difference Case Is < 1 'if the difference is less than 1 lbloverdate.Caption = 0 & " Day" Bishwanath Parajuli 381

Documentation for Easy Library Management System

'set specified label caption Case 1 'if the difference is 1 lbloverdate.Caption = 1 & " Day" Case Is > 1 'if the difference is more than 1 lbloverdate.Caption = (Y - X) & " Days" End Select Select Case (Y - X) 'calculate difference Case Is <= 0 'if the difference is less than equal to 0 lblfine.Caption = "" 'leave label caption blank Case Is < 7 'if the difference is less than 7 lblfine.Caption = (Y - X) * 2 Case Is >= 7 'if the difference is greater than equal to 7 lblfine.Caption = (7 * 2 + (Y - X - 7) * 5) End Select End Sub Sub list() 'This procedure populates the data into listview 'and modifys text color, by comparing the data with system date, if necessary If bdrecord.RecordCount <> 0 Then 'if the recordset is not empty bdrecord.MoveFirst 'move to first record While Not bdrecord.EOF 'until eof If bdrecord.Fields(1) = Val(cmbcode.Text) And _ bdrecord.Fields(2) = Val(cmbbrid.Text) Then 'if field value and combo content matches lstview.ListItems.clear 'clear listview Set lstitem = lstview.ListItems.add(, , bdrecord! BookCode) 'set the header of the list view 'set the subitems for list view from field value lstitem.SubItems(3) = bdrecord.Fields(2) lstitem.SubItems(5) = bdrecord.Fields(3) lstitem.SubItems(6) = bdrecord.Fields(4) lstitem.SubItems(7) = bdrecord.Fields(5) If precord.RecordCount <> 0 Then precord.MoveFirst While Not precord.EOF If precord.Fields(0) = cmbcode.Text Then 'set the subitems for list view from field value lstitem.SubItems(1) = precord.Fields(1) Bishwanath Parajuli 382

Documentation for Easy Library Management System

lstitem.SubItems(2) = precord.Fields(3) End If precord.MoveNext Wend End If If mrecord.RecordCount <> 0 Then mrecord.MoveFirst While Not mrecord.EOF If mrecord.Fields(0) = cmbbrid.Text Then 'set the subitems for list view from field value lstitem.SubItems(4) = mrecord.Fields(1) & " " & mrecord.Fields(2) & " " & mrecord.Fields(3) End If mrecord.MoveNext Wend End If If bdrecord.Fields(4) < VBA.Date Then 'if the field value is less than system date 'specify the color of the text lstitem.ForeColor = vbRed lstitem.ListSubItems(1).ForeColor = vbRed lstitem.ListSubItems(2).ForeColor = vbRed lstitem.ListSubItems(3).ForeColor = vbRed lstitem.ListSubItems(4).ForeColor = vbRed lstitem.ListSubItems(5).ForeColor = vbRed lstitem.ListSubItems(6).ForeColor = vbRed lstitem.ListSubItems(7).ForeColor = vbRed End If lbldatei.Caption = bdrecord.Fields(3) 'set the label caption from field value lbldater.Caption = bdrecord.Fields(4) Exit Sub Else lstview.ListItems.clear 'clear list view lbldatei.Caption = "Book is Not issued" lbldater.Caption = "Book is Not issued" End If bdrecord.MoveNext 'move to next record Wend 'repeat End If End Sub Sub history() 'This procedure adds record, specifys the key field and saves the data Bishwanath Parajuli 383

Documentation for Easy Library Management System

Dim code As Integer 'declare variable If hrecord.RecordCount = 0 Then 'if the recordset is empty code = 11 'set code = 11 Else hrecord.MoveLast 'move to last record code = hrecord.Fields(0) + 1 'increase the value of code by 1 compared to last record End If hrecord.AddNew 'allow to addnew record 'set the value of record field from specified form fields hrecord.Fields(0) = code hrecord.Fields(1) = cmbcode.Text hrecord.Fields(2) = cmbbrid.Text hrecord.Fields(3) = lbldatei.Caption hrecord.Fields(4) = VBA.Date If bdrecord.RecordCount <> 0 Then 'if the recordset is not empty bdrecord.MoveFirst 'move to first record While Not bdrecord.EOF 'until eof If bdrecord.Fields(1) = cmbcode Then 'if the field value and combo content match hrecord.Fields(5) = bdrecord.Fields(5) 'set the field value from specified record source End If bdrecord.MoveNext 'move to next record Wend 'repeat End If hrecord.Update 'save the record End Sub Private Sub mnulinker_Click() Unload Me 'unload form frmlinker.Show 'show the form End Sub

Bishwanath Parajuli

384

Documentation for Easy Library Management System

frmsearch: Option Explicit Private Sub cmdsearch_Click() 'This procedure searches the data search data On Error GoTo errorhandling: If txtsearch = "" And cmbtype = "" Then MsgBox "Select a data to search.", vbExclamation, "Search" Exit Sub End If 'if any option is selected 'configure ADODC control accordingly 'display the data in the datagrid If optissue.Value = True Then 'if the specified option button is selected If optdatei.Value = True Then Call textboxvisible 'call function Adodc1.CommandType = adCmdUnknown Adodc1.RecordSource = "Select * from qryissue where Date_of_Issue = Cdate('" & txtsearch & "')" 'specify the data source and the field Adodc1.Refresh 'refresh adodc ElseIf optdater.Value = True Then Call textboxvisible Adodc1.CommandType = adCmdUnknown Adodc1.RecordSource = "Select * from qryissue where Returning_Date = Cdate('" & txtsearch & "')" Adodc1.Refresh Else MsgBox "Select the means of searching issue details.", vbOKOnly, "Search" End If ElseIf optbook.Value = True Then If optbid.Value = True Then Call textboxvisible Adodc1.CommandType = adCmdUnknown Adodc1.RecordSource = "Select * from tblbookdetails where Book_Code = int('" & txtsearch & "')" Adodc1.Refresh ElseIf optbtitle.Value = True Then Call textboxvisible Adodc1.CommandType = adCmdUnknown Adodc1.RecordSource = "Select * from tblbookdetails where Title = ('" & txtsearch & "')" Bishwanath Parajuli 385

Documentation for Easy Library Management System

Adodc1.Refresh ElseIf opttype.Value = True Then Call combovisible Adodc1.CommandType = adCmdUnknown Adodc1.RecordSource = "Select * from tblbookdetails where Type_of_Book = ('" & cmbtype & "')" Adodc1.Refresh ElseIf optisbn.Value = True Then Call textboxvisible Adodc1.CommandType = adCmdUnknown Adodc1.RecordSource = "Select * from tblbookdetails where ISBN = int('" & txtsearch & "')" Adodc1.Refresh ElseIf optsno.Value = True Then Call textboxvisible Adodc1.CommandType = adCmdUnknown Adodc1.RecordSource = "Select * from tblbookdetails where Shelf_Number = int('" & txtsearch & "')" Adodc1.Refresh Else MsgBox "Select the means of searching book.", vbOKOnly, "Search" End If ElseIf optmem.Value = True Then If optmid.Value = True Then Call textboxvisible Adodc1.CommandType = adCmdUnknown Adodc1.RecordSource = "Select * from tblmember where ID = Int('" & txtsearch & "')" Adodc1.Refresh ElseIf optfname.Value = True Then Call textboxvisible Adodc1.CommandType = adCmdUnknown Adodc1.RecordSource = "Select * from tblmember where First_Name = ('" & txtsearch & "')" Adodc1.Refresh ElseIf optlevel.Value = True Then Call combovisible Adodc1.CommandType = adCmdUnknown Adodc1.RecordSource = "Select * from tblmember where Education_Level = ('" & cmbtype & "')" Adodc1.Refresh ElseIf optgender.Value = True Then Call combovisible Adodc1.CommandType = adCmdUnknown

Bishwanath Parajuli

386

Documentation for Easy Library Management System

Adodc1.RecordSource = "Select * from tblmember where Gender = ('" & cmbtype & "')" Adodc1.Refresh ElseIf optdatea.Value = True Then Call textboxvisible Adodc1.CommandType = adCmdUnknown Adodc1.RecordSource = "Select * from tblmember where Activation_Date = Cdate('" & txtsearch & "')" Adodc1.Refresh Else MsgBox "Select the means of searching the memeber.", vbOKOnly, "Search" End If ElseIf optauth.Value = True Then If optaid.Value = True Then Call textboxvisible Adodc1.CommandType = adCmdUnknown Adodc1.RecordSource = "Select * from tblauthor where Author_ID = int('" & txtsearch & "')" Adodc1.Refresh ElseIf optaname.Value = True Then Call textboxvisible Adodc1.CommandType = adCmdUnknown Adodc1.RecordSource = "Select * from tblauthor where Author_Name = ('" & txtsearch & "')" Adodc1.Refresh Else MsgBox "Select the means of searching the author.", vbOKOnly, "Search" End If ElseIf optpub.Value = True Then If optpid.Value = True Then Call textboxvisible Adodc1.CommandType = adCmdUnknown Adodc1.RecordSource = "Select * from tblpublisher where Publisher_id = int('" & txtsearch & "')" Adodc1.Refresh ElseIf optpname.Value = True Then Call textboxvisible Adodc1.CommandType = adCmdUnknown Adodc1.RecordSource = "Select * from tblpublisher where Publisher_Name = ('" & txtsearch & "')" Adodc1.Refresh Else MsgBox "Select the means of searching the publisher.", vbOKOnly, "Search" Bishwanath Parajuli 387

Documentation for Easy Library Management System

End If ElseIf optreserve.Value = True Then If optdaters.Value = True Then Call textboxvisible Adodc1.CommandType = adCmdUnknown Adodc1.RecordSource = "Select * from qryreserve where Reservation_Date = int('" & txtsearch & "')" Adodc1.Refresh ElseIf optbcode.Value = True Then Call textboxvisible Adodc1.CommandType = adCmdUnknown Adodc1.RecordSource = "Select * from qryreserve where Book_Code = int('" & txtsearch & "')" Adodc1.Refresh ElseIf optsid.Value = True Then Call textboxvisible Adodc1.CommandType = adCmdUnknown Adodc1.RecordSource = "Select * from qryreserve where Borrower_ID = int('" & txtsearch & "')" Adodc1.Refresh Else MsgBox "Select the means of searching the Reserved book.", vbOKOnly, "Search" End If End If If Adodc1.Recordset.RecordCount = 0 Then 'if there is no reord in the recordset then 'display message MsgBox "There is no record in this field.", vbInformation, "Search" End If Exit Sub errorhandling: MsgBox "Error No. > " & Err.Number & " / " & Err.Description, vbCritical, "Fatal Error" End Sub Private Sub cmdsearch_GotFocus() If txtsearch.Text <> "" Then 'if textbox is empty cmdsort.Enabled = True 'disable command button End If End Sub Private Sub cmdsort_Click() frmsort.Show 'show form Bishwanath Parajuli 388

Documentation for Easy Library Management System

frmsearch.Enabled = False 'disable form End Sub Private Sub Form_Load() 'This procedure configures ADODC path and provider Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data source = " & App.Path & "\Library Management System.mdb" End Sub Private Sub optaall_Click() 'if the option is selected then 'configure adodc to view record of the specified table If optaall.Value = True Then 'if option is selected Adodc1.CommandType = adCmdUnknown Adodc1.RecordSource = "Select * from tblauthor" 'specify the data table Adodc1.Refresh 'refresh adodc End If cmdsort.Enabled = True End Sub Private Sub optball_Click() 'if the option is selected then 'configure adodc to view record of the specified table If optball.Value = True Then Adodc1.CommandType = adCmdUnknown Adodc1.RecordSource = "Select * from tblbookdetails " Adodc1.Refresh End If cmdsort.Enabled = True End Sub Private Sub optiall_Click() 'if the option is selected then 'configure adodc to view record of the specified table If optiall.Value = True Then Adodc1.CommandType = adCmdUnknown Adodc1.RecordSource = "Select * from qryissue " Adodc1.Refresh End If cmdsort.Enabled = True End Sub Private Sub optmall_Click() Bishwanath Parajuli 389

Documentation for Easy Library Management System

'if the option is selected then 'configure adodc to view record of the specified table If optmall.Value = True Then Adodc1.CommandType = adCmdUnknown Adodc1.RecordSource = "Select * from tblmember" Adodc1.Refresh End If cmdsort.Enabled = True End Sub Private Sub optpall_Click() 'if the option is selected then 'configure adodc to view record of the specified table If optpall.Value = True Then Adodc1.CommandType = adCmdUnknown Adodc1.RecordSource = "Select * from tblpublisher" Adodc1.Refresh End If cmdsort.Enabled = True End Sub Private Sub optrall_Click() 'if the option is selected then 'configure adodc to view record of the specified table If optrall.Value = True Then Adodc1.CommandType = adCmdUnknown Adodc1.RecordSource = "Select * from qryreserve" Adodc1.Refresh End If cmdsort.Enabled = True End Sub Private Sub optaid_Click() Call textboxvisible 'call function End Sub Private Sub optaname_Click() Call textboxvisible End Sub Private Sub optauth_Click() Call disable5 End Sub Private Sub optbcode_Click() Call textboxvisible Bishwanath Parajuli 390

Documentation for Easy Library Management System

End Sub Private Sub optbid_Click() Call textboxvisible End Sub Private Sub optbook_Click() Call disable2 End Sub Private Sub optbtitle_Click() Call textboxvisible End Sub Private Sub optdatea_Click() Call textboxvisible End Sub Private Sub optdatei_Click() Call textboxvisible End Sub Private Sub optdater_Click() Call textboxvisible End Sub Private Sub optdaters_Click() Call textboxvisible End Sub Private Sub optfname_Click() Call textboxvisible End Sub Private Sub optgender_Click() Call combovisible Call typeg End Sub Private Sub optisbn_Click() Call textboxvisible End Sub Private Sub optissue_Click() Call disable1 End Sub

Bishwanath Parajuli

391

Documentation for Easy Library Management System

Private Sub optlevel_Click() Call combovisible Call typel End Sub Private Sub optmem_Click() Call disable3 End Sub Private Sub optmid_Click() Call textboxvisible End Sub Private Sub optpid_Click() Call textboxvisible End Sub Private Sub optpname_Click() Call textboxvisible End Sub Private Sub optpub_Click() Call disable6 End Sub Private Sub optreserve_Click() Call disable7 End Sub Private Sub optsid_Click() Call textboxvisible End Sub Private Sub optsno_Click() Call textboxvisible End Sub Private Sub opttype_Click() Call combovisible Call typeb End Sub Sub typeb() 'This procedure clear addsitem in combobox cmbtype.clear 'clear combo 'populate combo Bishwanath Parajuli 392

Documentation for Easy Library Management System

cmbtype.AddItem "Fiction" cmbtype.AddItem "Non Fiction" cmbtype.AddItem "Periodical" cmbtype.AddItem "Reference" End Sub Sub typeg() 'This procedure clear addsitem in combobox cmbtype.clear cmbtype.AddItem "Male" cmbtype.AddItem "Female" End Sub Sub typel() 'This procedure clear addsitem in combobox Dim i As Integer cmbtype.clear For i = 1 To 10 cmbtype.AddItem i Next i cmbtype.AddItem "Teachers and Staffs" End Sub Sub textboxvisible() 'This procedure shows textbox and hides combobox txtsearch.Visible = True txtsearch.Enabled = True cmbtype.Visible = False cmbtype.Enabled = False End Sub Sub combovisible() 'This procedure shows combobox and hides textbox txtsearch.Visible = False txtsearch.Enabled = False cmbtype.Visible = True cmbtype.Enabled = True End Sub Sub disable1() 'This procedure shows/hides the frame specified below 'enables/disables the frame specified below fraissue.Enabled = True fraissue.Visible = True frabook.Enabled = False frabook.Visible = False Bishwanath Parajuli 393

Documentation for Easy Library Management System

framem.Enabled = False framem.Visible = False fraauth.Visible = False fraauth.Enabled = False frapub.Enabled = False frapub.Visible = False frares.Visible = False frares.Enabled = False End Sub Sub disable2() 'This procedure shows/hides the frame specified below 'enables/disables the frame specified below fraissue.Enabled = False fraissue.Visible = False frabook.Enabled = True frabook.Visible = True framem.Enabled = False framem.Visible = False fraauth.Visible = False fraauth.Enabled = False frapub.Enabled = False frapub.Visible = False frares.Visible = False frares.Enabled = False End Sub Sub disable3() 'This procedure shows/hides the frame specified below 'enables/disables the frame specified below fraissue.Enabled = False fraissue.Visible = False frabook.Enabled = False frabook.Visible = False framem.Enabled = True framem.Visible = True fraauth.Visible = False fraauth.Enabled = False frapub.Enabled = False frapub.Visible = False frares.Visible = False frares.Enabled = False End Sub Sub disable4() 'This procedure shows/hides the frame specified below 'enables/disables the frame specified below Bishwanath Parajuli 394

Documentation for Easy Library Management System

fraissue.Enabled = False fraissue.Visible = False framem.Enabled = False framem.Visible = False fraauth.Visible = False fraauth.Enabled = False frapub.Enabled = False frapub.Visible = False frabook.Enabled = False frabook.Visible = False frares.Visible = False frares.Enabled = False End Sub Sub disable5() 'This procedure shows/hides the frame specified below 'enables/disables the frame specified below fraissue.Enabled = False fraissue.Visible = False framem.Enabled = False framem.Visible = False frapub.Enabled = False frapub.Visible = False frabook.Enabled = False frabook.Visible = False fraauth.Visible = True fraauth.Enabled = True frares.Visible = False frares.Enabled = False End Sub Sub disable6() 'This procedure shows/hides the frame specified below 'enables/disables the frame specified below fraissue.Enabled = False fraissue.Visible = False framem.Enabled = False framem.Visible = False fraauth.Enabled = False fraauth.Visible = False frabook.Enabled = False frabook.Visible = False frapub.Enabled = True frapub.Visible = True frares.Visible = False frares.Enabled = False Bishwanath Parajuli 395

Documentation for Easy Library Management System

End Sub Sub disable7() 'This procedure shows/hides the frame specified below 'enables/disables the frame specified below fraissue.Enabled = False fraissue.Visible = False framem.Enabled = False framem.Visible = False fraauth.Enabled = False fraauth.Visible = False frabook.Enabled = False frabook.Visible = False frapub.Enabled = False frapub.Visible = False frares.Visible = True frares.Enabled = True End Sub

Bishwanath Parajuli

396

Documentation for Easy Library Management System

frmsort: Private Sub cmbsort_Click() frasort.Enabled = True 'enable controls txtfilter.Enabled = True End Sub Private Sub cmdfilter_Click() 'This procedure filters the recordset's record On Error GoTo errorhandling: If cmbsort.Text = "" Or frmsearch.Adodc1.Recordset.RecordCount = 0 Then 'if the combo is empty or recordset is empty MsgBox "Select Sort Option", vbInformation, "Select" ElseIf cmbsort.Text <> "" Or frmsearch.Adodc1.Recordset.RecordCount <> 0 Then frmsearch.Adodc1.Recordset.Filter = cmbsort & " like '" & txtfilter.Text & "%'" 'if all of the fields are attended then filter 'filter by selecting fieldlist from combobox and filter item from textbox Exit Sub 'exit End If Exit Sub errorhandling: MsgBox "Error No. > " & Err.Number & " / " & Err.Description, vbCritical, "Fatal Error" End Sub Private Sub cmdunload_Click() Unload Me End Sub Private Sub Form_Load() 'This procedure adds item to combobox 'if the fields below are selected from 'frmsearch' If frmsearch.optauth.Value = True Then 'if the specified option button is selected cmbsort.clear 'clear combo cmbsort.AddItem "Author_Name" 'populate combo ElseIf frmsearch.optpub.Value = True Then cmbsort.clear cmbsort.AddItem "Publisher_Name" ElseIf frmsearch.optmem.Value = True Then cmbsort.clear cmbsort.AddItem "First_Name" Bishwanath Parajuli 397

Documentation for Easy Library Management System

cmbsort.AddItem "Gender" ElseIf frmsearch.optbook.Value = True Then cmbsort.clear cmbsort.AddItem "Title" cmbsort.AddItem "Type_of_Book" cmbsort.AddItem "ISBN" End If End Sub Private Sub Form_Unload(Cancel As Integer) frmsearch.Enabled = True 'enable form End Sub Private Sub optasc_Click() 'This procedure sorts the record ascending On Error GoTo errhandle: If frmsearch.Adodc1.Recordset.RecordCount <= 1 Then 'if the recordset has 1 or less than 1 data MsgBox "Sorting failed. No or only one record.", vbOKOnly + vbExclamation, "Sorting..." Else frmsearch.Adodc1.Recordset.Sort = Me.cmbsort.Text 'sort ascending End If Exit Sub errhandle: MsgBox "Error No. > " & Err.Number & " / " & Err.Description, vbCritical, "Error" End Sub Private Sub optdsc_Click() 'This procedure sorts the record descending On Error GoTo errhandle: If frmsearch.Adodc1.Recordset.RecordCount <= 1 Then 'if the recordset has 1 or less than 1 data MsgBox "Sorting failed. No or only one record.", vbOKOnly + vbExclamation, "Sorting..." Else frmsearch.Adodc1.Recordset.Sort = Me.cmbsort.Text & " desc" 'Sort descending End If Exit Sub errhandle: MsgBox "Error No. > " & Err.Number & " / " & Err.Description, vbCritical, "Error" Bishwanath Parajuli 398

Documentation for Easy Library Management System

End Sub

Bishwanath Parajuli

399

Documentation for Easy Library Management System

frmSplash: Option Explicit Private Sub Form_Load() 'This procedure configures ADODB connection Call connection 'call function Call preferrecset Call finerecset End Sub Private Sub Form_Unload(Cancel As Integer) 'This procedure displays message on "total fine collected", 'and shows form as specified Dim fine, count As Integer 'declare variable Dim checkmem, checkbook As String If mdimain.sbrmain.Panels(3).Text <> "User :- Visitor" Then 'if the status bar doesn't have text as specified If srecord.RecordCount <> 0 Then 'if the recordset is not empty srecord.MoveFirst 'move to first record While Not srecord.EOF 'until eof If srecord.Fields(3) = "Yes" Then 'if field value is yes If brecord.RecordCount <> 0 Then brecord.MoveFirst While Not brecord.EOF fine = brecord.Fields(4) + fine 'sum up all the data in the field brecord.MoveNext Wend End If MsgBox "You have Rs." & fine & " left to be collected.", vbInformation, "Fine" End If If srecord.Fields(0) = "No" Then 'if the field value is no checkbook = "No" 'set variable = no ElseIf srecord.Fields(0) = "Yes" Then checkbook = "Yes" End If If srecord.Fields(1) = "No" Then checkmem = "No" ElseIf srecord.Fields(1) = "Yes" Then checkmem = "Yes" End If srecord.MoveNext 'move to next record Bishwanath Parajuli 400

Documentation for Easy Library Management System

Wend 'repeat End If If checkmem = "Yes" Then frmovmem.Show End If If checkbook = "Yes" Then frmreminders.Show End If End If End Sub Private Sub Timer1_Timer() 'This procedure changes the value of progressbar Static pv As Integer 'declare variable pv = pv + 1 'increase value of variable by 1 ProgressBar2.Value = pv 'set the value to progress bar If pv = 100 Then 'set variable to 100 pv = 0 Unload Me 'close the form mdimain.Show End If End Sub Private Sub Timer2_Timer() 'This procedure shows/hides the shapes as configured If shp1.Visible = True Then shp1.Visible = False shp2.Visible = True shp3.Visible = False shp4.Visible = False ElseIf shp2.Visible = True Then shp2.Visible = False shp3.Visible = True shp1.Visible = False shp4.Visible = False ElseIf shp3.Visible = True Then shp3.Visible = False shp1.Visible = False shp2.Visible = False shp4.Visible = True ElseIf shp4.Visible = True Then shp3.Visible = False shp1.Visible = True shp2.Visible = False shp4.Visible = False End If Bishwanath Parajuli 401

Documentation for Easy Library Management System

End Sub

Bishwanath Parajuli

402

Documentation for Easy Library Management System

frmsupplier: Private Sub chkdet_Click() If chkdet.Value = vbChecked Then 'if the checkbox is checked Me.Height = 7650 'set the height ElseIf chkdet.Value = vbUnchecked Then 'if the checkbox is checked Me.Height = 4200 End If End Sub Private Sub cmddelete_Click() 'This procedure deletes the record from the recordset Dim supname As String 'declare variable supname = InputBox("Enter the supplier's name or code you want to delete?", "Delete") 'display input box to enter data If srecord.RecordCount <> 0 Then 'if the recordset is not empty srecord.MoveFirst 'move to first record While Not srecord.EOF 'until eof If srecord.Fields(1) = supname Or srecord.Fields(0) = supname Then 'if field value and variable match srecord.Delete 'delete the record Call checknavigation 'call the function Me.suppliertimer.Enabled = True 'enable timer MsgBox "Record Deleted.", vbInformation, "Deleted" End If srecord.MoveNext 'move to next record Wend 'repeat End If End Sub Private Sub cmdmail_Click() frmemail.Show 'show the form frmemail.txtadd = Me.txtcontact 'set the textarea in the new window End Sub Private Sub cmdmodify_Click() 'This procedure modifies the record of the specified recordset If srecord.RecordCount <> 0 Then 'if the recordset is not empty

Bishwanath Parajuli

403

Documentation for Easy Library Management System

If MsgBox("Are you sure you want to do this?", vbYesNo) = vbYes Then srecord.MoveFirst 'move to first record While Not srecord.EOF 'until eof If srecord.Fields(0) = Me.lblcode Then 'if field and label match 'set the field with new data srecord.Fields(1) = txtsname.Text srecord.Fields(2) = txtadd srecord.Fields(3) = txtcontact srecord.Update 'save the data suppliertimer.Enabled = True 'enable timer MsgBox "Record edited sucessfully.", vbInformation, "Update" End If srecord.MoveNext 'move to next record Wend 'repeat End If End If End Sub Private Sub cmdrefresh_Click() 'This procedure resets all the fields txtsname = "" txtadd = "" txtcontact = "" txtsname.Enabled = True txtadd.Enabled = True txtcontact.Enabled = True End Sub Private Sub cmdsave_Click() 'This procedure adds new record, assigns key field and saves it Dim code As Integer 'declare variable If txtsname.Text = "" Or txtadd.Text = "" Or txtcontact.Text = "" Then 'if the textboxes are empty MsgBox "Please, fill all the fields.", vbExclamation, "Error" Exit Sub 'exit End If If srecord.RecordCount = 0 Then 'if recordset is empty code = 801 'set code =801 Else srecord.MoveLast ' move to last record Bishwanath Parajuli 404

Documentation for Easy Library Management System

code = srecord.Fields(0) + 1 'set code by increasing the value of last record by 1 End If srecord.AddNew 'add new record 'set the data in record field srecord.Fields(0) = code srecord.Fields(1) = txtsname.Text srecord.Fields(2) = txtadd srecord.Fields(3) = txtcontact srecord.Update 'save the data suppliertimer.Enabled = True 'enable timer MsgBox "Record saved successfully.", vbInformation, "Supplier" Call checknavigation 'call function End Sub Private Sub cmdsearch_Click() 'This procedure displays the searched data Dim supname As String 'declare variable supname = InputBox("Enter the supplier's name or code you want to Find?", "Find") 'allow to enter the data If srecord.RecordCount <> 0 Then srecord.MoveFirst 'move to first record While Not srecord.EOF 'until eof If srecord.Fields(1) = supname Or srecord.Fields(0) = supname Then 'if field and variable match Me.txtsname = srecord.Fields(1) 'set the field value into specified objects txtsname.Enabled = False 'disabel controls Me.txtadd = srecord.Fields(2) txtadd.Enabled = False Me.txtcontact = srecord.Fields(3) txtcontact.Enabled = False End If srecord.MoveNext 'move to next record Wend End If End Sub Private Sub cmdsearch_LostFocus() cmdsearch.Visible = False 'hide button End Sub

Bishwanath Parajuli

405

Documentation for Easy Library Management System

Private Sub Form_Load() 'This procedure configures ADODB and ADODC connection Call connection 'call function Call supplierrecset adosupplier.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data source = " & App.Path & "\Library Management System.mdb" 'configure provider and application path adosupplier.CommandType = adCmdUnknown adosupplier.RecordSource = "select * from tblsupplier" 'specify the data source adosupplier.Refresh 'refresh adodc Call checknavigation 'call function End Sub Private Sub suppliertimer_Timer() 'This procedure refreshes the datagrid On Error GoTo errhandler: supgrid.Refresh 'refresh data grid adosupplier.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data source = " & App.Path & "\Library Management System.mdb" 'configure provider and application path adosupplier.CommandType = adCmdUnknown adosupplier.RecordSource = "select * from tblsupplier" 'specify the data source adosupplier.Refresh 'refresh adodc supgrid.Refresh 'refresh grid suppliertimer.Enabled = False 'disable timer Exit Sub errhandler: MsgBox Err.Description, vbCritical, "Error" End Sub Private Sub txtsname_Change() If txtsname = "" Then 'if textbox is empty Me.cmdsearch.Visible = True 'show button End If End Sub Private Sub txtsname_LostFocus() 'This procedure checks for any exixting data If srecord.RecordCount <> 0 Then 'if the recorset is not empty srecord.MoveFirst 'move to first record Bishwanath Parajuli 406

Documentation for Easy Library Management System

While Not srecord.EOF 'until eof If srecord.Fields(1) = txtsname.Text Then 'compare textbox and field value and if matched MsgBox "This Supplier Exists already.", vbInformation, "Supplier Details" txtsname.SetFocus 'shift focus cmdsave.Enabled = False 'disable button Exit Sub Else cmdsave.Enabled = True 'enable button End If srecord.MoveNext 'move to next record Wend 'repeat End If End Sub Private Sub cmdnext_Click() On Error GoTo errhandle 'This procedure moves pointer to next relative record If srecord.AbsolutePosition = adPosBOF Then 'if absolute position of the record is at bof then srecord.MoveLast 'move record pointer to last record Exit Sub ElseIf srecord.EOF = True Then MsgBox "This is Last record", vbInformation, "Information" srecord.MoveLast Exit Sub Else Call viewdata 'call function srecord.MoveNext 'move record pointer to next record End If Exit Sub errhandle: MsgBox Err.Description, vbCritical, "Error" End Sub Private Sub cmdprevious_Click() 'This procedure moves pointer to previous relative record On Error GoTo errhandle If srecord.AbsolutePosition = adPosEOF Then 'if record pointer is at eof then srecord.MoveFirst 'move record pointer to first record Exit Sub ElseIf srecord.BOF = True Then 'if record pointer is at bof then continue with: Bishwanath Parajuli 407

Documentation for Easy Library Management System

MsgBox "This is First record", vbInformation, "Information" srecord.MoveFirst 'move to first record Exit Sub Else Call viewdata 'call function srecord.MovePrevious 'move record pointer to previous record End If Exit Sub errhandle: MsgBox Err.Description, vbCritical, "Error" End Sub Sub viewdata() 'This procedure assigns value to form fields from the recordset Me.lblcode = srecord.Fields(0) Me.txtsname = srecord.Fields(1) Me.txtadd = srecord.Fields(2) Me.txtcontact = srecord.Fields(3) End Sub Private Sub cmdbegin_Click() 'This procedure moves pointer to first record On Error GoTo errhandle If srecord.BOF = True Then 'if the record pointer is at bof then MsgBox "This is First record", vbInformation, "Information" srecord.MoveFirst 'move record pointer to first record Exit Sub ElseIf srecord.AbsolutePosition = adPosBOF Then 'if absolute position of the record is at bof then srecord.MoveFirst 'move record pointer to last record Exit Sub Else Call viewdata 'call function srecord.MoveFirst 'moves pointer to first record End If Exit Sub errhandle: MsgBox Err.Description, vbCritical, "Error" End Sub Private Sub cmdlast_Click() Bishwanath Parajuli 408

Documentation for Easy Library Management System

'This procedure moves pointer to last record On Error GoTo errhandle If srecord.EOF = True Then 'if record pointer is at eof then MsgBox "This is Last record", vbInformation, "Information" srecord.MoveLast 'move record pointer to last record Exit Sub Else Call viewdata 'call function srecord.MoveLast 'move record pointer to last record End If Exit Sub errhandle: MsgBox Err.Description, vbCritical, "Error" End Sub Sub checknavigation() 'This procedure enables/disables navigation buttons If srecord.RecordCount = 0 Then 'if recordset is empty franavigate.Enabled = False 'disable frame ElseIf srecord.RecordCount <> 0 Then 'if recordset is not empty franavigate.Enabled = True 'enable frame End If End Sub

Bishwanath Parajuli

409

Documentation for Easy Library Management System

mdimain: Dim checkdb As Boolean 'declare checkdb as boolean Private Sub MDIForm_Load() 'This procedure configures the ADODB connection 'and deletes record from the connection 'lrecord' if necessary Dim count As Integer 'declare variable Call connection 'call functions Call issuerecset Call reserverecset Call memeberrecset Call booklistrecset If bdrecord.RecordCount <> 0 Then 'if the recordset is not empty bdrecord.MoveFirst 'move to first record While Not bdrecord.EOF 'until eof If bdrecord.Fields(4) <= VBA.Date Then 'if the field value is older than system date bdrecord.Fields(6) = "No" 'set field value to No ElseIf bdrecord.Fields(4) > VBA.Date Then 'if the field value is not older than system date bdrecord.Fields(6) = "Yes" 'set field value to yes End If bdrecord.MoveNext 'move to next record Wend 'repeat End If If lrecord.RecordCount <> 0 Then lrecord.MoveFirst While Not lrecord.EOF If lrecord.Fields(4) < VBA.Date Then 'if the records are older than system date lrecord.Delete 'delete record MsgBox "Reservation that had crossed its due" & vbCrLf &_ "have been deleted.", vbInformation, "" End If lrecord.MoveNext Wend End If End Sub Private Sub mnubackupdb_Click() Call backup 'call functions Bishwanath Parajuli 410

Documentation for Easy Library Management System

End Sub Private Sub mnuabout_Click() frmAbout.Show 'show form End Sub Private Sub mnubookdetail_Click() frmbookdet.Show End Sub Private Sub mnubookrpt_Click() bookreport.Show 'show report End Sub Private Sub mnubooksupplier_Click() frmsupplier.Show End Sub Private Sub mnucompactandrepairdb_Click() sbrmain.Panels(4) = "Compacting and Repairing Database.." 'set text for status bar Call compact 'call function End Sub Private Sub mnuexit_Click() 'This procedure displays messagebox 'and if messagebox returns with response yes then 'unloads this form If MsgBox("Do you want to exit?", vbYesNo + vbQuestion, "Exit") = vbYes Then Unload Me Else mdimain.Show End If End Sub Private Sub mnugeneral_Click() frmoverview.Show End Sub Private Sub mnuhistory_Click() frmhistory.Show End Sub Private Sub mnuissue_Click() frmissue.Show End Sub Bishwanath Parajuli 411

Documentation for Easy Library Management System

Private Sub MDIForm_QueryUnload(Cancel As Integer, UnloadMode As Integer) 'This procedure displays messagebox 'and if messagebox returns with response yes then 'unloads this form and creates backup or compacts the database if configured Call connection 'call function Call preferrecset If mdimain.Visible = True Then If MsgBox("Are you sure you want to quit?", vbQuestion + vbYesNo, "Quit") = vbNo Then UnloadMode = 1 'set unload mode to 1 Cancel = 1 'and cancel status to 1 Exit Sub 'exit End If Else Unload Me If srecord.RecordCount <> 0 Then 'if the record set is not empty srecord.MoveFirst 'move to first record While Not srecord.EOF 'until eof If srecord.Fields(2) = "Yes" Then 'if field value is yes Call compact 'call function End If If srecord.Fields(4) = "Yes" Then Call backup End If srecord.MoveNext 'move to next record Wend 'repeat End If End If End Sub Private Sub mnumemberdetail_Click() frmborrowerdetails.Show End Sub Private Sub mnuissueoverview_Click() frmglance.Show End Sub Private Sub mnumembershipoverview_Click() frmovmem.Show End Sub Bishwanath Parajuli 412

Documentation for Easy Library Management System

Private Sub mnumemrpt_Click() detailreport.Show End Sub Private Sub mnuprefer_Click() frmprefer.Show End Sub Private Sub mnurequest_Click() frmbooklist.Show End Sub Private Sub mnupublisherauthor_Click() frmpubnauth.Show End Sub Private Sub mnurenewreturn_Click() frmlinker.Show End Sub Private Sub mnureserverpt_Click() reservereport.Show End Sub Private Sub mnuduerpt_Click() duereport.Show End Sub Private Sub mnufinerpt_Click() finereport.Show End Sub Private Sub mnureserve_Click() frmreserve.Show End Sub Private Sub mnurestore_Click() 'This procedure defines the destination file 'and copies the file into the destination Dim result 'declare variable sbrmain.Panels(4) = "Restoring Backup..." 'set caption for panels in status bar cdlg.Filter = "Microsoft Access File|*.mdb" 'filter filetypes with extension '.jpg' cdlg.ShowOpen 'show common dialog box with open button Bishwanath Parajuli 413

Documentation for Easy Library Management System

If cdlg.FileName <> "" Then result = apiCopyFile(cdlg.FileName, App.Path & "\Library Management System.mdb", False) 'copy file from source file to destination file. MsgBox "Backup restored sucessfully.", vbInformation, "Restore" End If sbrmain.Panels(4) = "" End Sub Private Sub mnusecurity_Click() frmnuserandcpass.Show End Sub Private Sub mnusearch_Click() frmsearch.Show End Sub Private Sub mditime_timer() Me.sbrmain.Panels(2) = VBA.Time End Sub Private Sub tbrmain_ButtonClick(ByVal Button As MSComctlLib.Button) 'This procedure displays form according to the button menu index clicked Select Case Button.Index 'load the button indexes Case 7 'if button index is as specified frmsearch.Show 'open specified form Case 9 frmemail.Show End Select End Sub Private Sub tbrmain_ButtonMenuClick(ByVal ButtonMenu As MSComctlLib.ButtonMenu) 'This procedure displays form according to the button menu clicked Select Case ButtonMenu.Text 'load text under button menu Case "Issue" 'if the text is as specified frmissue.Show 'load the specified window Case "Renew or Return" frmlinker.Show Case "Reserve" frmreserve.Show Case "User Details" Bishwanath Parajuli 414

Documentation for Easy Library Management System

frmnuserandcpass.Show Case "Change User" Me.Hide frmLogin.Show Case "Book" frmbookdet.Show Case "Member" frmborrowerdetails.Show Case "Publisher/Author" frmpubnauth.Show Case "Supplier" frmsupplier.Show End Select End Sub Private Sub mnutotalfine_Click() frmfinecollection.Show End Sub Sub backup() 'This procedure defines the destination file 'and copies the file into the destination Dim result 'declare variable sbrmain.Panels(4) = "Creating Backup..." 'set text for status bar cdlg.ShowSave 'show common dialog box with save button If cdlg.FileName <> "" Then 'if the filename of the dialog box is not empty result = apiCopyFile(App.Path & "\Library Management System.mdb", cdlg.FileName & ".mdb", False) 'copy file from source file as database of the application MsgBox "Backup created sucessfully.", vbInformation, "Backup" End If sbrmain.Panels(4) = "" End Sub Sub compact() 'This procedure compacts the current database 'copies the current database into tempDB 'kills the currentDB 'and renames the tempDB Dim stTempDBfile As String 'declare variables Dim origin, final As Long origin = FileLen(App.Path & "/Library Management System.mdb") 'specify the length of file Bishwanath Parajuli 415

Documentation for Easy Library Management System

stTempDBfile = App.Path & "/tempDBfile.mdb" 'specify temporary database On Error Resume Next Kill stTempDBfile 'delete the temp file if it already exists, skip errors, if it does not exist create one dao.DBEngine.CompactDatabase App.Path & "/Library Management System.mdb", stTempDBfile Kill currentdbname 'delete the current database FileCopy stTempDBfile, App.Path & "/Library Management System.mdb" 'copy the contents of the file to database in the application path Kill stTempDBfile 'delete the temporarydb dao.DBEngine.RepairDatabase App.Path & "/Library Management System.mdb" 'repair database final = FileLen(App.Path & "/Library Management System.mdb") MsgBox "Database compacted " & ((origin - final) / origin) * 100 & "% " & vbCrLf & _ "and repaired Successfully.", _ vbInformation, "Database Compacted" sbrmain.Panels(4) = "" End Sub

Bishwanath Parajuli

416

Documentation for Easy Library Management System

Module: Declare Function apiCopyFile Lib "kernel32" Alias "CopyFileA" _ (ByVal lpExistingFileName As String, ByVal lpNewFileName As String, _ ByVal bFailIfExists As Long) As Long 'define all the variables used Global connect As ADODB.connection 'declare the adodb connection Global precord As ADODB.Recordset 'declare adodb recordsets Global bdrecord As ADODB.Recordset Global mrecord As ADODB.Recordset Global lrecord As ADODB.Recordset Global brecord As ADODB.Recordset Global hrecord As ADODB.Recordset Global srecord As ADODB.Recordset Global nrecord As ADODB.Recordset Sub connection() 'set new connection Set connect = New ADODB.connection 'set new recordset Set precord = New ADODB.Recordset Set brecord = New ADODB.Recordset Set bdrecord = New ADODB.Recordset Set mrecord = New ADODB.Recordset Set lrecord = New ADODB.Recordset Set hrecord = New ADODB.Recordset Set srecord = New ADODB.Recordset Set nrecord = New ADODB.Recordset connect.Provider = "Microsoft.jet.OLEDB.4.0" 'set the connection provider connect.ConnectionString = "Data source =" & App.Path & "\Library Management System.mdb " 'set the data source path connect.Open 'open connection with the above password End Sub Sub bookrecset() 'set the recordset by opening it from specified table

Bishwanath Parajuli

417

Documentation for Easy Library Management System

precord.Open "select * from tblbookdetails", connect, adOpenKeyset, adLockPessimistic End Sub Sub memeberrecset() 'set the recordset by opening it from specified table mrecord.Open "select * from tblmember", connect, adOpenKeyset, adLockPessimistic End Sub Sub issuerecset() 'set the recordset by opening it from specified table bdrecord.Open "select * from tblissue", connect, adOpenKeyset, adLockPessimistic End Sub Sub qryissuerecset() 'set the recordset by opening it from specified table bdrecord.Open "select * from qryissue", connect, adOpenKeyset, adLockPessimistic End Sub Sub security() 'set the recordset by opening it from specified table precord.Open "select * from tblusers", connect, adOpenKeyset, adLockOptimistic End Sub Sub author() 'set the recordset by opening it from specified table bdrecord.Open "select * from tblauthor", connect, adOpenKeyset, adLockPessimistic End Sub Sub publisher() 'set the recordset by opening it from specified table brecord.Open "select * from tblpublisher", connect, adOpenKeyset, adLockPessimistic End Sub Sub reserverecset() 'set the recordset by opening it from specified table lrecord.Open "select * from tblreserve", connect, adOpenKeyset, adLockPessimistic End Sub

Bishwanath Parajuli

418

Documentation for Easy Library Management System

Sub finerecset() 'set the recordset by opening it from specified table brecord.Open "select * from tblfine", connect, adOpenKeyset, adLockPessimistic End Sub Sub qryfinerecset() 'set the recordset by opening it from specified table srecord.Open "select * from qryfine", connect, adOpenKeyset, adLockPessimistic End Sub Sub supplierrecset() 'set the recordset by opening it from specified table srecord.Open "select * from tblsupplier", connect, adOpenKeyset, adLockPessimistic End Sub Sub preferrecset() 'set the recordset by opening it from specified table srecord.Open "select * from tblsettings", connect, adOpenKeyset, adLockPessimistic End Sub Sub historyrecset() 'set the recordset by opening it from specified table hrecord.Open "select * from tblhistory", connect, adOpenKeyset, adLockPessimistic End Sub Sub booklistrecset() 'set the recordset by opening it from specified table nrecord.Open "select * from tblorderbooklist", connect, adOpenKeyset, adLockPessimistic End Sub

Bishwanath Parajuli

419

Documentation for Easy Library Management System

dataenv: Private Sub DataEnvironment_Initialize() pconnect.Provider = "Microsoft.jet.OLEDB.4.0" 'specify provider pconnect.ConnectionString = "Data source =" & App.Path & "\Library Management System.mdb" 'specify data source pconnect.Open 'open the connection End Sub

Bishwanath Parajuli

420

Вам также может понравиться