You are on page 1of 49

LS

LIBRARY SYSTEM

BY
ANJARIA SAVAN (042102)
CHAUHAN TEJAS (042225)

FOR
COURSE - PROJECT IN VISUAL BASIC
BE COMPUTER ENGINEERING
2006

TO
COMPUTER ENGINEERING DEPARTMENT
ATMIYA INSTITUTE OF TECHNOLOGY AND SCIENCE
RAJKOT
INDIA
ACKNOWLEDGEMENT

With immense pleasure we would like to present this project


assignment of

LS Library Management System


We are thankful to all who have helped a lot for successful
completion of the project and for providing valuable guidance
throughout our project work. So we take this opportunity to thank
people who have made this project a success.

We offer our sincere thank to:


MISS. RUTA K.
For providing their expert guidance to us and also her unconditional
and unbiased support. During the whole session of our study and
development they provided us a favorable environment. Without
them we would not have achieved our goal.

The project has given us immense knowledge to use in our


future ventures and many moments to cherish.
LIBRARY SYSTEM DOCUMENATION

CONTENTS

01. ACKNOWLEDGMENT

02. CONTENTS
03. PREFACE

04. PROJECT SPECIFICATION

05. SOFTWARE STUDY

06. OVERVIEW OF LS

07. THE DATABASE

08. THE OPEN SOURCE CODE AND SNAP-SHOTS

09. SUPPORTS
PREFACE

The library is an important module for any educational


institute. Library may contain thousands of books, and its
management is a very tough job. The care should be taken for
proper distribution of the resources. It should be managed in a
manner so that its resources are used efficiently and conveniently.
For this rules and rights should be provided to each user.

Manual management of such a large system is a very tideous


job and errors may occur sometimes. This may affect the integrity
and consistency of the system resulting in an improper resource
distribution.

Here we have provided a full-fledged library management


system, which will change the conventional manual management
with a computerized library management system. We have tried our
best to provide efficient and convenient transectory operations for
librarian and users.

We are very much thankful to all those who directly or


indirectly helped us in completing this project.

Anjaria Savan
Chauhan Tejas
PROJECT SPECIFICATIONS

Project Title: LS Library Management System

Institution: Atmiya Institute Of Technology And


Science

Front End Tool: Microsoft Visual Basic 6.0

Back End Tool: Microsoft Office Access 2003

Documentation Tool: Microsoft office Word 2003

Operating System: Microsoft Windows XP

Requirements: Platform:
Microsoft Windows 9x, NT and
onwards

Hardware:
32-bit Processor, 300 MHz
32 MB RAM,
Printer

Submitted By: Anjaria Savan


Chauhan Tejas

Submitted To: Computer Engineering Department


Atmiya Institute of Technology And
Science Rajkot
SOFTWARE STUDY
 Software used for the development of the project are:

 Microsoft Visual Basic 6.0


 Microsoft Access 7.0

 About Visual Basic 6.0

Visual Basic developed from the old Quick Basic language that
was available under the DOS operating system. Quick Basic is
the same language as BASIC; it is just Microsoft's product name
for its version of BASIC. Visual Basic started out as the Brainchild
of Alan Cooper. Cooper developed Visual Basic and then sold the
product to Microsoft. Microsoft took the undeveloped product,
code-named it "Thunder," the proceeded to create a
programming language that would soon become one of the
premier development environments in the windows environment.

 Features Of Visual Basic

 Visual Basic is a superset of the Visual Basic for


Applications (VBA) programming language, which is
included with most of the office products.
 Includes a GUI development environment for development
Windows applications.
 Provides the ability to develop and test applications using
an interpretive run function.
 Allows for the creation of p-code and native code EXE files.
P-code is a tokenized form of your source code that will be
broken down at runtime into machine code. P-code can be
stored more efficiently and executed faster than your
source code, which is why Visual Basic will create this
intermediary form.
 Object-based development is possible using class modules.
 Rapid application development (RAD).
 Allows for the creation of COM components such as ActiveX
controls, DLLs, and EXEs.
 Has many internet development possibilities, including the
following:

1. ActiveX documents.
2. DHTML applications that help you test browser
application.
3. IIS applications that help you build server-based
application.
4. Web browser control.
5. FTP / HTTP support through a custom control.
6. Winsock control.
 Has an excellent integrated Help facility and Books Online?
Including good debugging facilities. It has many wizards
that help automate repetitive tasks.
 Can be extended easily through the use of Windows API
calls, hundreds of third party controls and DLLs, and
integration with other Windows applications through Com
and DCOM.
 Uses many database access methods to get at different
types of data.

 Visual Basic Advantages

 Visual Basic has many advantages over other development


languages. Here's a list of some of these advantages:

 Has A shorter learning curve and development time than


C/C++, Delphi and even Power Builder.
 Removes the complexities of the Windows API form the
programmer.
 Allows for rapid application development.
 Excellent for business applications.
 Used by most of the office suite tools as their macro
language, with the rest to follow. Other companies as well
are starting to support VBA in their products, such as
AutoCAD, Corel Draw, SAP, and many others.
 Allow you to create ActiveX controls.
 Allows you to reuse third-party controls and component, as
well as your own.
 Supplies wizards to help you learn the language as well as
to enhance your productivity with the more difficult
features of the language.
 Object oriented in nature. It's not a complete OOP
language, but it's getting closer.
 Can integrate with the Internet on both the server side and
the client side.
 Can create ActiveX Automation servers.
 Integrates with Microsoft Transaction server.
 Can run servers either on the same machine or remotely
on another computer. This allows for true distributed
processing.
 Visual Basic has a large community of developers. (More
than 3 million worldwide according to Microsoft). This
means continued support for new developers.
 MS Access 7.0

Microsoft Access is a powerful RDBMS tool. With its extensive


features, it is easier to manage large volume of database. As the
project requires large database MS ACCESS 7.0 is the perfect
option as a back-end tool.
Overview of LS:

Adding the ADOCE Control to an Application

The ADOCE version 3.1 control is a separate download that must be


setup in addition to the SDKs that ship with Microsoft eMbedded
Visual Tools 3.0. Nine files must be downloaded onto the device in
order for the control to work. Several of these files must be
registered on the device. To register a component on a device, use
the Control Manager in eMbedded Visual Basic or use the
Regsvrce.exe utility. For information on how to use the
Regsvrce.exe utility, consult the Microsoft eMbedded Visual Tools
3.0 documentation. For information on how to distribute the ADOCE
control and component files with your application, see the topic
"Distributing an ADOCE Application".

Before you can use the ADOCE control in eMbedded Visual Basic,
you must create a reference to the control in the integrated
development environment (IDE). If the control is registered with the
Control Manager, the correct components will be installed when you
run your application on a device. The following procedure shows
how to create a reference to the ADOCE control in the eMbedded
Visual Basic IDE.

To use the ADO for Windows CE control in eMbedded Visual Basic


3.0

1. Choose References from the Project menu


2. In the References dialog box, select the check box next to
Microsoft CE ADO Control 3.1.
3. Choose OK.
4. The following code sample shows how to programmatically
reference the ADOCE control using eMbedded Visual Basic.

Dim objConnection 'Declare a variable for the connection


Dim objRecordset 'Declare a variable for the recordset
Set objConnection = CreateObject("ADOCE.Connection.3.1")
Set objRecordset = CreateObject("ADOCE.Recordset.3.1")

Previous versions of the ADOCE control (2.0) do not have a version


number in the programmatic identifiers, or ProgIDS; however, the
new ADOCE 3.1 and ADOCE 3.0 do contain version numbers in both
the programmatic identifiers, or ProgIDS. If you do not specifically
update your previous code to refer to version 3.1 of the control, an
earlier version of the control may be instantiated, if it exists in a
device’s ROM. If the device's ROM does not contain an earlier
version, you will get an "Invalid procedure call or argument:
'CreateObject'" error when you execute your application. The
following ProgIDs are used with the ADOCE version 3.1 control.

ADOCE Object ProgID


Connection ADOCE.Connection.3.1
Recordset ADOCE.Recordset.3.1

Toolbars

A toolbar is a control bar that contains the bitmap images of


controls. These images can behave like pushbuttons, check boxes,
or radio buttons. MFC supplies class CToolbar to manage toolbars.

If you enable it, users of MFC toolbars can dock them to the edge of
a window or "float" them anywhere within the application window.
MFC doesn’t support customizable toolbars like those in the
development environment.

MFC also supports tool tips: small pop-up windows that describe a
toolbar button's purpose when you position the mouse over the
button. By default, when the user presses a toolbar button, a status
string appears in the status bar (if there is one). You can activate
"fly by" status bar updating to display the status string when the
mouse is positioned over the button without pressing it.

Note As of MFC version 4.0, toolbars and tool tips are


implemented using Windows 95 functionality instead of the previous
implementation specific to MFC. For more information, see the
article Toolbars.

For backward compatibility, MFC retains the older toolbar


implementation in class COldToolBar. The documentation for earlier
versions of MFC describe COldToolBar under CToolBar.

Create a first toolbar in your program by selecting the Initial


Toolbar option in AppWizard. You can also create additional
toolbars.

CProgressCtrl

You can use the progress control to indicate the progress of a


lengthy operation. It is a rectangle that is gradually filled with the
system highlight color as the operation progresses.

The progress control is represented in MFC by class CProgressCtrl.


When you initially create the progress control, you specify its size
and position, parent window (usually a dialog box), and ID. By
using the dwStyle parameter, you can also specify various window
styles for the control and styles for how it fills.

Using the SSTab Control

The SSTab control provides an easy way of presenting several


dialogs or screens of information on a single form using the same
interface seen in many commercial Microsoft Windows applications.

The SSTab control provides a group of tabs, each of which acts as a


container for other controls. Only one tab is active in the control at
a time, displaying the controls it contains to the user while hiding
the controls in the other tabs.

Possible Uses

• To create a Microsoft Office or Windows 95 (or later) style


tabbed dialog box.

• To create a custom tabbed dialog box.

Tab Object

A Tab object represents an individual tab in the Tabs collection of a


TabStrip control.

Remarks

For each Tab object, you can use various properties to specify its
appearance, and you can specify its state with the Selected
property.

At design time, use the Insert Tab and Remove Tab buttons on the
Tabs tab in the Properties Page of the TabStrip control to insert and
remove tabs, and use the text boxes to specify any of these
properties for a Tab object: Caption, Image, ToolTipText, Tag,
Index, and/or Key. You can also specify these properties at run
time.

Use the Caption and Image properties, separately or together, to


label or put an icon on a tab.

• To use the Caption property, in the Caption text box on the


Tabs tab in the Properties Page of the TabStrip control, type
the text you want to appear on the tab or button at run time.
• To use the Image property, put an ImageList control on the
form and fill the ListImages collection with ListImage objects,
each of which has an index number and an optional key, if
you add one. On the General tab in the Properties Page of the
TabStrip control, select that ImageList to associate it with the
TabStrip control. In the Image text box on the Tabs tab, type
the index number or key of the ListImage object that should
appear on the Tab object.

Use the ToolTipText property to temporarily display a string of text


in a small rectangular box at run time when the user's cursor
hovers over the tab. To set the ToolTipText property at design time,
select the ShowTips checkbox on the General tab, and then in the
ToolTipText text box on the Tabs tab, type the ToolTip string.

To return a reference to a Tab object a user has selected, use the


SelectedItem property; to determine whether a specific tab is
selected, use the Selected property. These properties are useful in
conjunction with the BeforeClick event to verify or record data
associated with the currently-selected tab before displaying the next
tab the user selects.

Each Tab object also has read-only properties you can use to
reference a single Tab object in the Tabs collection: Left, Top,
Height and Width.

DataGrid Control

Displays and enables data manipulation of a series of rows and


columns representing records and fields from a Recordset object.

Remarks

The data-aware DataGrid control appears similar to the Grid


control; however, you can set the DataGrid control's DataSource
property to a Data control so that the control is automatically filled
and its column headers set automatically from a Data control's
Recordset object. The DataGrid control is really a fixed collection of
columns, each with an indeterminate number of rows.

Each cell of a DataGrid control can hold text values, but not linked
or embedded objects. You can specify the current cell in code, or
the user can change it at run time using the mouse or the arrow
keys. Cells can be edited interactively, by typing into the cell, or
programmatically. Cells can be selected individually or by row.
If a cell's text is too long to be displayed in the cell, the text wraps
to the next line within the same cell. To display the wrapped text,
you must increase the cell's Column object's Width property and/or
the DataGrid control's RowHeight property. At design time, you can
change the column width interactively by resizing the column or by
changing the column's width in the Column object's property page.

Use the DataGrid control's Columns collection's Count property and


the Recordset object's RecordCount property to determine the
number of columns and rows in the control. A DataGrid control can
have as many rows as the system resources can support and up to
32767 columns.

When you select a cell, the ColIndex property is set, thus selecting
one of the Column objects in the DataGrid object's Columns
collection. The Text and Value properties of the Column object
reference the contents of the current cell. The data in the current
row can be accessed using the Bookmark property, which provides
access to the underlying Recordset object's record. Each column of
the DataGrid control has its own font, border, word wrap, and other
attributes that can be set without regard to other columns. At
design time, you can set the column width and row height and
establish columns that are not visible to the user. You can also
prevent users from changing the formatting at run time.

Note If you set any of the DataGrid column properties at design


time, you will need to set all of them in order to maintain the
current settings.

Note If you use the Move method to position the DataGrid control,
you may need to use the Refresh method to force it to repaint.

The DataGrid control functions similarly to the DBGrid control


except that it doesn't support an unbound mode.

Note This control is Unicode-enabled. When used on a Unicode-


enabled system such as Microsoft Windows NT, the control passes
Unicode data with no conversion. On other systems, however, data
is converted from ANSI to Unicode and back. For more information,
see "ANSI, DBCS, and Unicode: Definitions" in the Programmer's
Guide.
FORMS:

Startup form: MDIlibsys.frm


Login form: frmlogin.frm
Change Username and Password: frmchnguidpass.frm
Administrator form frmlibsysadmin.frm
Student form frmlibsysstu.frm
Add or Delete book form frmadddeleteb.frm
Edit form: frmedit.frm
Available Book form frmavaibook.frm
Search form: frmsearchbook.frm
Transaction form: frmissuereturn.frm
Issued Book form frmissuebook.frm
Book returning today form frmbookretoday.frm
Fined Book form frmfinebook.frm
Total Book form frmtotalbook.frm
Rules and regulations form frmshowrules.frm
Edit Rules and regulations form frmeditrules.frm
Help form frmhelp.frm
About us form: frmaboutus.frm
The Database
Table: Totalbooks

This table stores basic information about books; information


stored in this table is filled at the time of new book entry, data
stored in this table are changed only when the table is edited.
Access No. is a field which is defined as primary key and it stores
the number by which book is uniquely identified.

Columns
Name Type Size
---------------------------------------------------------------------
Book Name Text 60
Edition Text 10
Pages Text 10
Author Text 60
Publisher Text 50
Department Text 30
Subject Text 20
ISBN Text 20
Price Currency -
Access No (Primary Key) Long Integer -
Place Text 200

Table: issuebook

This table stores the information about all the transaction


performed. If book is issued or returned to or from staff or student
then according changes are made to the table. Access No. is defined
as a primary key, other information is stored about the staff or
student by which any employee can be uniquely identified. Issue
Date and Return Date of the book is stored for later library use. Also
reg. no. of student is stored in the table.

Columns
Name Type Size
----------------------------------------------------------------------
Book Name Text 60
Edition Text 10
Author Text 60
Department Text 30
Subject Text 20
ISBN Text 20
Access No (Primary Key) LongInteger -
Price Currency -
Issue Date Date/Time -
Return Date Date/Time -
Reg No. Text 10

Table: Avaibook

This table stores the information about all the available books.
If book is issued or returned to or from staff or student then
according changes are made to the table. Access No. is defined as a
primary key.

Columns
Name Type Size
---------------------------------------------------------------------
Book Name Text 60
Edition Text 10
Author Text 60
Department Text 30
Subject Text 20
ISBN Text 20
Price Currency -
Access No (Primary Key) LongInteger -

Table: login

This table stores the password for administrator login and


student login. It has four columns; ‘namemgmt’ , ’namestu’ ,
‘passmgmt’ and ‘passstu’. The main thing to be noted is user name
and password is encrypted and encryption is performed at the front-
end level.
Columns
Name Type Size
---------------------------------------------------------------------
Administrator id Text 10
Administrator Password Text 8
Student id Text 10
Student Password Text 8
The Source Code

MODULE
Option Explicit
Public con As ADODB.Connection
Public rs As ADODB.Recordset
Public rsfine As ADODB.Recordset
Public rsday As ADODB.Recordset
Public rsavai As ADODB.Recordset
Public rsissue As ADODB.Recordset
Public rstotal As ADODB.Recordset
Public sql As String
Public sqlfine As String
Public sqlday As String
Public sqlavai As String
Public sqlissue As String
Public sqltotal As String
Public onamemgmt As String
Public opassmgmt As String
Public onamestu As String
Public opassstu As String
Public imgX As ListImage
Public btnX As Button

Public Sub datalinkopen()

Set con = New ADODB.Connection


Set rs = New ADODB.Recordset
Set rsfine = New ADODB.Recordset
Set rsday = New ADODB.Recordset
Set rsavai = New ADODB.Recordset
Set rsissue = New ADODB.Recordset
Set rstotal = New ADODB.Recordset

con.Open ("Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=I:\tejas\04CE125\4th_sem\vb\project\libsys.mdb;Per
sist Security Info=False")
rs.Open "select * from login", con, 3, 3
sql = "select * from login"
Set rs = con.Execute(sql)
rsfine.Open "select * from multiplier", con, 3, 3
sqlfine = "select * from multiplier"
Set rsfine = con.Execute(sqlfine)
rsday.Open "select * from returndays", con, 3, 3
sqlday = "select * from returndays"
Set rsday = con.Execute(sqlday)
rsavai.Open "select * from avaibook", con, 3, 3
sqlavai = "select * from avaibook"
Set rsavai = con.Execute(sqlavai)
rsissue.Open "select * from issuebook", con, 3, 3
sqlissue = "select * from issuebook"
Set rsissue = con.Execute(sqlissue)
rstotal.Open "select * from totalbooks", con, 3, 3
sqltotal = "select * from totalbooks"
Set rstotal = con.Execute(sqltotal)

End Sub
Public Sub datalinkclose()

rs.Close
rsfine.Close
rsavai.Close
rstotal.Close
con.Close

End Sub
Public Sub loadtbs()

Set imgX = MDIlibsys.ImageList2.ListImages. _


Add(, "home", LoadPicture(App.Path & "\icon\home.ico"))
Set imgX = MDIlibsys.ImageList2.ListImages. _
Add(, "logout", LoadPicture(App.Path & "\icon\logout.ico"))
Set imgX = MDIlibsys.ImageList2.ListImages. _
Add(, "search", LoadPicture(App.Path & "\icon\search.ico"))
Set imgX = MDIlibsys.ImageList2.ListImages. _
Add(, "help", LoadPicture(App.Path & "\icon\help.bmp"))
Set imgX = MDIlibsys.ImageList2.ListImages. _
Add(, "about", LoadPicture(App.Path & "\icon\about.bmp"))

MDIlibsys.Toolbar2.ImageList = MDIlibsys.ImageList2

Set btnX = MDIlibsys.Toolbar2.Buttons.Add(, "home", ,


tbrDefault, "home")
btnX.ToolTipText = "Home"
btnX.Description = btnX.ToolTipText

Set btnX = MDIlibsys.Toolbar2.Buttons.Add(, "logout", ,


tbrDefault, "logout")
btnX.ToolTipText = "Logout"
btnX.Description = btnX.ToolTipText

Set btnX = MDIlibsys.Toolbar2.Buttons.Add(, , ,


tbrPlaceholder)
Set btnX = MDIlibsys.Toolbar2.Buttons.Add(, "search", ,
tbrDefault, "search")
btnX.ToolTipText = "Search"
btnX.Description = btnX.ToolTipText

Set btnX = MDIlibsys.Toolbar2.Buttons.Add(, , ,


tbrPlaceholder)

Set btnX = MDIlibsys.Toolbar2.Buttons.Add(, "help", ,


tbrDefault, "help")
btnX.ToolTipText = "Help"
btnX.Description = btnX.ToolTipText

Set btnX = MDIlibsys.Toolbar2.Buttons.Add(, "about", ,


tbrDefault, "about")
btnX.ToolTipText = "About us"
btnX.Description = btnX.ToolTipText

End Sub

Public Sub loadtba()

Set imgX = MDIlibsys.ImageList1.ListImages. _


Add(, "home", LoadPicture(App.Path & "\icon\home.ico"))
Set imgX = MDIlibsys.ImageList1.ListImages. _
Add(, "logout", LoadPicture(App.Path & "\icon\logout.ico"))
Set imgX = MDIlibsys.ImageList1.ListImages. _
Add(, "add", LoadPicture(App.Path & "\icon\add.ico"))
Set imgX = MDIlibsys.ImageList1.ListImages. _
Add(, "delete", LoadPicture(App.Path & "\icon\delete.ico"))
Set imgX = MDIlibsys.ImageList1.ListImages. _
Add(, "search", LoadPicture(App.Path & "\icon\search.ico"))
Set imgX = MDIlibsys.ImageList1.ListImages. _
Add(, "help", LoadPicture(App.Path & "\icon\help.bmp"))
Set imgX = MDIlibsys.ImageList1.ListImages. _
Add(, "about", LoadPicture(App.Path & "\icon\about.bmp"))

MDIlibsys.Toolbar1.ImageList = MDIlibsys.ImageList1

Set btnX = MDIlibsys.Toolbar1.Buttons.Add(, "home", ,


tbrDefault, "home")
btnX.ToolTipText = "Home"
btnX.Description = btnX.ToolTipText
Set btnX = MDIlibsys.Toolbar1.Buttons.Add(, "logout", ,
tbrDefault, "logout")
btnX.ToolTipText = "Logout"
btnX.Description = btnX.ToolTipText

Set btnX = MDIlibsys.Toolbar1.Buttons.Add(, , ,


tbrPlaceholder)

Set btnX = MDIlibsys.Toolbar1.Buttons.Add(, "add", ,


tbrDefault, "add")
btnX.ToolTipText = "Add"
btnX.Description = btnX.ToolTipText

Set btnX = MDIlibsys.Toolbar1.Buttons.Add(, "delete", ,


tbrDefault, "delete")
btnX.ToolTipText = "Delete"
btnX.Description = btnX.ToolTipText

Set btnX = MDIlibsys.Toolbar1.Buttons.Add(, "search", ,


tbrDefault, "search")
btnX.ToolTipText = "Search"
btnX.Description = btnX.ToolTipText

Set btnX = MDIlibsys.Toolbar1.Buttons.Add(, , ,


tbrPlaceholder)

Set btnX = MDIlibsys.Toolbar1.Buttons.Add(, "help", ,


tbrDefault, "help")
btnX.ToolTipText = "Help"
btnX.Description = btnX.ToolTipText

Set btnX = MDIlibsys.Toolbar1.Buttons.Add(, "about", ,


tbrDefault, "about")
btnX.ToolTipText = "About us"
btnX.Description = btnX.ToolTipText

End Sub
START UP

Public log As Boolean


Public imgX As ListImage
Public btnX As Button

Private Sub abt_Click()

frmaboutus.Show

End Sub
Private Sub avaibooks_Click()

frmavaibook.Show
frmavaibook.SetFocus

End Sub
Private Sub book_Click()

frmsearchbook.Show
frmsearchbook.SetFocus

End Sub
Private Sub chnguidpass_Click()
frmchnguidpass.Show
frmchnguidpass.SetFocus

End Sub

Private Sub editdays_Click()

frmedit.Show
frmedit.SetFocus
frmedit.fmmulti.Visible = False
frmedit.fmdays.Visible = True
frmedit.txtndaysvalue.SetFocus

End Sub
Private Sub editfine_Click()

frmedit.Show
frmedit.SetFocus
frmedit.fmdays.Visible = False
frmedit.fmmulti.Visible = True
frmedit.txtnmultivalue.SetFocus

End Sub
Private Sub editlibbook_Click()

frmadddeleteb.Show
frmadddeleteb.SetFocus
Unload frmtotalbook

End Sub
Private Sub editrulesreg_Click()

frmeditrules.Show
frmeditrules.SetFocus
Unload frmshowrules

End Sub
Private Sub exit_Click()

Module1.datalinkclose

Unload Me

End Sub

Private Sub finebook_Click()


frmfinebook.Show
frmfinebook.SetFocus

End Sub
Private Sub helptotic_Click()

frmhelp.Show

End Sub
Private Sub issue_Click()

frmissuereturn.Show
frmissuereturn.tbissuereturn.Tab = 0
frmissuereturn.txtisaccess.SetFocus
Unload frmavaibook
Unload frmissuebook

End Sub
Private Sub issuebooks_Click()

frmissuebook.Show
frmissuebook.SetFocus

End Sub
Private Sub libbooks_Click()

frmtotalbook.Show
frmtotalbook.SetFocus

End Sub
Private Sub login_Click()

If log = False Then


frmlogin.Show
frmlogin.SetFocus
ElseIf log = True Then
login.Caption = "Login"
log = False

frmadddeleteb.Hide
frmavaibook.Hide
frmbookretoday.Hide
frmchnguidpass.Hide
frmedit.Hide
frmeditrules.Hide
frmfinebook.Hide
frmissuebook.Hide
frmissuereturn.Hide
frmlibsysadmin.Hide
frmlibsysstu.Hide
frmlogin.Hide
frmsearchbook.Hide
frmshowrules.Hide
frmtotalbook.Hide

admin.Enabled = False
view.Enabled = False
chnguidpass.Enabled = False
edit.Enabled = False
search.Enabled = False
help.Enabled = False

Toolbar1.Visible = False
Toolbar2.Visible = False

frmlogin.Show

End If

End Sub

Private Sub MDIForm_Load()

Module1.datalinkopen

admin.Enabled = False
view.Enabled = False
chnguidpass.Enabled = False
edit.Enabled = False
search.Enabled = False
help.Enabled = False

pb1.Value = 0

log = False

Toolbar1.Visible = False
Toolbar2.Visible = False

End Sub
Private Sub return_Click()

frmissuereturn.Show
frmissuereturn.tbissuereturn.Tab = 1
frmissuereturn.txtreaccess.SetFocus
Unload frmavaibook
Unload frmbookretoday
Unload frmfinebook
Unload frmissuebook

End Sub
Private Sub returntdbooks_Click()

frmbookretoday.Show
frmbookretoday.SetFocus

End Sub
Private Sub rulesreg_Click()

frmshowrules.Show
frmshowrules.SetFocus

End Sub
Private Sub timer_Timer()

pb1.Value = pb1.Value + 1
If pb1.Value = 100 Then
timer.Enabled = False
pb1.Visible = False
piclibsys.Visible = False
picimage.Visible = False
frmlogin.Show
End If

End Sub

Private Sub Toolbar1_ButtonClick(ByVal Button As


MSComctlLib.Button)

Select Case Button.Key


Case "home": frmadddeleteb.Hide
frmavaibook.Hide
frmbookretoday.Hide
frmchnguidpass.Hide
frmedit.Hide
frmeditrules.Hide
frmfinebook.Hide
frmissuebook.Hide
frmissuereturn.Hide
frmlogin.Hide
frmsearchbook.Hide
frmshowrules.Hide
frmtotalbook.Hide
frmlibsysadmin.Show
Case "logout": login_Click
Case "add": frmadddeleteb.Show
frmadddeleteb.SSTab1.Tab = 0
Case "delete": frmadddeleteb.Show
frmadddeleteb.SSTab1.Tab = 1
Case "search": frmsearchbook.Show
Case "help": frmhelp.Show
Case "about": frmaboutus.Show
End Select

End Sub
Private Sub Toolbar2_ButtonClick(ByVal Button As
MSComctlLib.Button)

Select Case Button.Key


Case "home": frmavaibook.Hide
frmbookretoday.Hide
frmissuebook.Hide
frmlogin.Hide
frmsearchbook.Hide
frmshowrules.Hide
frmtotalbook.Hide
frmlibsysstu.Show
Case "logout": login_Click
Case "search": frmsearchbook.Show
Case "help": frmhelp.Show
Case "about": frmaboutus.Show
End Select

End Sub
LOGIN

Dim ok As Integer

Private Sub cmdcancel_Click()

Unload Me

End Sub
Private Sub cmdlogok_Click()

fmlogged.Visible = False
If ok = 0 Then
fmlogin.Visible = True
ElseIf txtpass.Text = opassmgmt Then
frmlibsysadmin.Show
MDIlibsys.admin.Enabled = True
MDIlibsys.chnguidpass.Enabled = True
MDIlibsys.view.Enabled = True
MDIlibsys.edit.Enabled = True
MDIlibsys.search.Enabled = True
MDIlibsys.help.Enabled = True
MDIlibsys.Toolbar1.Visible = True
Module1.loadtba
Unload Me
ElseIf txtpass.Text = opassstu Then
frmlibsysstu.Show
MDIlibsys.view.Enabled = True
MDIlibsys.search.Enabled = True
MDIlibsys.help.Enabled = True
MDIlibsys.Toolbar2.Visible = True
Module1.loadtbs
Unload Me
End If

End Sub
Private Sub cmdok_Click()

fmlogin.Visible = False
fmlogged.Visible = True
If (txtname.Text = onamemgmt And txtpass.Text =
opassmgmt) Or (txtname.Text = onamestu And txtpass.Text
= opassstu) Then
lbllog.Caption = "You have logged successfully..."
ok = 1
MDIlibsys.login.Caption = "Logout"
MDIlibsys.log = True
Else
lbllog.Caption = "login failed..." & vbNewLine & "user name
or password incorrect"
ok = 0
End If

End Sub
Private Sub Form_Load()

fmlogged.Visible = False
lbldate.Caption = Format(Date, "dddd, d mmmm, yyyy")

onamemgmt = rs.Fields("namemgmt").Value
opassmgmt = rs.Fields("passmgmt").Value
onamestu = rs.Fields("namestu").Value
opassstu = rs.Fields("passstu").Value

End Sub
CHANGE UID & PASSWORD

Dim ok As Integer
Dim nname As String
Dim npass As String

Private Sub cmdchng_Click()


fmchng.Visible = False
fmchngok.Visible = True
If txtnpass.Text = txtrnpass.Text Then
nname = txtnname.Text
npass = txtnpass.Text
If txtoname.Text = onamemgmt And txtopass.Text =
opassmgmt Then
lblchngok.Caption = "Your management Uid and
password" & vbNewLine & "have been changed
successfully..."
ok = 1
sql = "update login set namemgmt = '" & nname & "'
where passmgmt = '" & opassmgmt & "' "
con.Execute (sql)
sql = "update login set passmgmt = '" & npass & "'
where passmgmt = '" & opassmgmt & "' "
con.Execute (sql)
ElseIf txtoname.Text = onamestu And txtopass.Text =
opassstu Then
lblchngok.Caption = "Your student Uid and password" &
vbNewLine & "have been changed successfully..."
ok = 2
sql = "update login set namestu = '" & nname & "'
where passstu = '" & opassstu & "' "
con.Execute (sql)
sql = "update login set passstu = '" & npass & "' where
passstu = '" & opassstu & "' "
con.Execute (sql)
Else
lblchngok.Caption = "Your Uid and password" &
vbNewLine & "are incorrect..."
ok = 4
End If
Else
lblchngok.Caption = "New password mismatch" &
vbNewLine & "Please retype password."
ok = 0
End If
End Sub
Private Sub cmdchngcancel_Click()

Unload Me

End Sub
Private Sub cmdchngok_Click()

If ok = 0 Or ok = 4 Then
fmchngok.Visible = False
fmchng.Visible = True
ElseIf ok = 1 Or ok = 2 Then
Unload Me
End If

End Sub
Private Sub Form_Load()

ok = 0
nname = ""
npass = ""

onamemgmt = rs.Fields("namemgmt").Value
opassmgmt = rs.Fields("passmgmt").Value
onamestu = rs.Fields("namestu").Value
opassstu = rs.Fields("passstu").Value
End Sub
EDIT RETURN DAYS

EDIT FINE MULTIPLIER


Dim ofine As Integer
Dim nfine As Integer
Dim oday As Integer
Dim nday As Integer
Private Sub cmdcancel_Click(Index As Integer)

Unload Me

End Sub
Private Sub cmddaysok_Click()
fmdays.Visible = False
fmok.Visible = True
nday = Val(txtndaysvalue.Text)

sqlday = "update returndays set days = " & nday & " where
days = " & oday & " "
con.Execute (sqlday)

lblok.Caption = "Your new return days value" & vbNewLine &


"is set to " & txtndaysvalue.Text

End Sub
Private Sub cmdmultiok_Click()
fmdays.Visible = False
fmok.Visible = True
nfine = Val(txtnmultivalue.Text)
sqlfine = "update multiplier set fine = " & nfine & " where fine
= " & ofine & " "
con.Execute (sqlfine)

lblmultiok.Caption = "Your new fine value" & vbNewLine & "is


set to " & txtnmultivalue.Text

End Sub
Private Sub cmdok_Click()

Unload Me

End Sub
Private Sub Form_Load()
ofine = rsfine.Fields("fine").Value
lblomultivalue.Caption = ofine
oday = rsday.Fields("days").Value
lblodaysvalue.Caption = oday

End Sub
EDIT LIBRARY BOOKS
Private Sub cmdadd_Click()

sqltotal = "insert into totalbooks values ('" & txtbookname &


"','" & txtedition & "','" & txtpages & "','" & txtauthor & "','" &
txtpublisher & "','" & txtdept & "','" & txtsub & "','" & txtisbn &
"','" & txtprice & "'," & txtaccessno & ",'" & txtplace.Text & "')"
con.Execute (sqltotal)

If chkavaibook.Value = 1 Then
sqlavai = "insert into avaibook values ('" & txtbookname &
"','" & txtedition & "','" & txtauthor & "','" & txtdept & "','" &
txtsub & "','" & txtisbn & "','" & txtprice & "'," & txtaccessno &
")"
con.Execute (sqlavai)
End If

txtbookname.Text = ""
txtedition.Text = ""
txtpages.Text = ""
txtauthor.Text = ""
txtpublisher.Text = ""
txtdept.Text = ""
txtsub.Text = ""
txtisbn.Text = ""
txtprice.Text = ""
txtaccessno.Text = ""
txtplace.Text = ""

MsgBox ("New Book has been successfully added.")

End Sub
Private Sub cmddelete_Click()

sqltotal = "delete from totalbooks where accessno = " &


txtaccessnod & ""
con.Execute (sqltotal)

Do While rsavai.EOF = False


If Val(txtaccessnod.Text) = rsavai.Fields("AccessNo").Value
Then

sqlavai = "delete from avaibook where AccessNo = " &


txtaccessnod & ""
con.Execute (sqlavai)

rsavai.MoveNext
Else
rsavai.MoveNext
End If
Loop
rsavai.MoveFirst

txtaccessnod.Text = ""
txtisbnd.Text = ""
txtbooknamed.Text = ""
txteditiond.Text = ""
txtauthord.Text = ""
txtdeptd.Text = ""
txtsubd.Text = ""
txtpriced.Text = ""
txtpagesd.Text = ""
txtpublisherd.Text = ""

MsgBox ("Book has been deleted successfully.")

End Sub
Private Sub txtaccessnod_LostFocus()
Dim ano As Integer

Do While rstotal.EOF = False


ano = rstotal.Fields("accessno").Value
If ano = Val(txtaccessnod.Text) Then
txtisbnd.Text = rstotal.Fields("ISBN").Value
txtbooknamed.Text = rstotal.Fields("Book Name").Value
txteditiond.Text = rstotal.Fields("Edition").Value
txtauthord.Text = rstotal.Fields("Author").Value
txtdeptd.Text = rstotal.Fields("department").Value
txtsubd.Text = rstotal.Fields("Subject").Value
txtpriced.Text = rstotal.Fields("Price").Value
txtpagesd.Text = rstotal.Fields("Pages").Value
txtpublisherd.Text = rstotal.Fields("Publisher").Value

rstotal.MoveNext
Else
rstotal.MoveNext
End If
Loop
rstotal.MoveFirst

End Sub

AVAILABLE BOOKS
ISSUED BOOKS

BOOKS RETURNING TODAY


ISSUE BOOK
RETURN BOOK

Private Sub cmdcancel_Click(Index As Integer)

Unload Me

End Sub
Private Sub cmdissue_Click()

If txtisaccess.Text = "" Then


MsgBox ("Please enter access no. ")
Else
sqlavai = "delete from avaibook where accessno = " &
txtisaccess.Text & " "
con.Execute (sqlavai)
sqlissue = "insert into issuebook values ('" &
txtisname.Text & "','" & txtisedition.Text & "','" &
txtisauthor.Text & "','" & txtisdept.Text & "','" & txtissub.Text
& "','" & txtisisbn.Text & "'," & txtisaccess.Text & ",'" &
txtisprice & "','" & txtisdate.Text & "','" & txtisreturndate.Text
& "','" & txtisregno.Text & "')"
con.Execute (sqlissue)
MsgBox ("Data base have been updated successfully")

txtisaccess.Text = ""
txtisisbn.Text = ""
txtisname.Text = ""
txtisedition.Text = ""
txtisauthor.Text = ""
txtisdept.Text = ""
txtissub.Text = ""
txtisprice.Text = ""
txtisdate.Text = ""
txtisreturndate.Text = ""
txtisregno.Text = ""
End If

End Sub
Private Sub cmdrereturn_Click()

If txtreaccess.Text = "" Then


MsgBox ("Please enter access no. ")
Else
sqlissue = "delete from issuebook where accessno = " &
txtreaccess.Text & " "
con.Execute (sqlissue)
sqlavai = "insert into avaibook values ('" & txtrename.Text
& "','" & txtreedition.Text & "','" & txtreauthor.Text & "','" &
txtredept.Text & "','" & txtresub.Text & "','" & txtreisbn.Text &
"','" & txtreprice & "'," & txtreaccess.Text & ")"
con.Execute (sqlavai)
MsgBox ("Data base have been updated successfully")

txtreaccess.Text = ""
txtreisbn.Text = ""
txtrename.Text = ""
txtreedition.Text = ""
txtreauthor.Text = ""
txtredept.Text = ""
txtresub.Text = ""
txtreprice.Text = ""
txtreissuedate.Text = ""
txtrereturndate.Text = ""
txtreregno.Text = ""
txtfine.Text = ""
End If

End Sub
Private Sub txtisaccess_LostFocus()
Dim ano As Integer
Dim dtf As Boolean

dtf = False
Do While rsavai.EOF = False
ano = rsavai.Fields("accessno").Value

If ano = Val(txtisaccess.Text) Then


txtisisbn.Text = rsavai.Fields("ISBN").Value
txtisname.Text = rsavai.Fields("Book Name").Value
txtisedition.Text = rsavai.Fields("Edition").Value
txtisauthor.Text = rsavai.Fields("Author").Value
txtisdept.Text = rsavai.Fields("department").Value
txtissub.Text = rsavai.Fields("Subject").Value
txtisprice.Text = rsavai.Fields("Price").Value
txtisdate.Text = Date
txtisreturndate.Text = Date + rsday.Fields("days").Value

rsavai.MoveNext
Else
rsavai.MoveNext
End If
dtf = True
Loop
If dtf = True Then
rsavai.MoveFirst
End If

End Sub
Private Sub txtreaccess_LostFocus()
Dim ano As Integer
Dim fine As Integer
Dim dtf As Boolean

dtf = False
fine = 0
Do While rsissue.EOF = False
ano = rsissue.Fields("accessno").Value

If ano = Val(txtreaccess.Text) Then


txtreisbn.Text = rsissue.Fields("ISBN").Value
txtrename.Text = rsissue.Fields("Book Name").Value
txtreedition.Text = rsissue.Fields("Edition").Value
txtreauthor.Text = rsissue.Fields("Author").Value
txtredept.Text = rsissue.Fields("Department").Value
txtresub.Text = rsissue.Fields("Subject").Value
txtreprice.Text = rsissue.Fields("Price").Value
txtreissuedate.Text = rsissue.Fields("Issue Date").Value
txtrereturndate.Text = rsissue.Fields("Return
Date").Value
txtreregno.Text = rsissue.Fields("Reg No").Value
If Date > rsissue.Fields("Return Date").Value Then
fine = ((Date - rsissue.Fields("Return Date").Value) *
rsfine.Fields("fine"))
End If
txtfine.Text = fine

rsissue.MoveNext
Else
rsissue.MoveNext
End If
dtf = True
Loop
If dtf = True Then
rsissue.MoveFirst
End If

End Sub

SEARCH BOOK

Dim r As Long
Dim c As Long
Private Sub cmdgo_Click()
t1.Enabled = True
pb.Value = 0
pb.Visible = True
lblsearch(1).Visible = True

End Sub
Private Sub Form_Load()
pb.Value = 0
t1.Enabled = False
r=1

End Sub
Private Sub t1_Timer()
pb.Value = pb.Value + 2
If pb.Value = 100 Then
pb.Visible = False
lblsearch(1).Visible = False
t1.Enabled = False
fgsearch.Visible = True
fgsearch.ColWidth(1) = 3700
fgsearch.ColWidth(2) = 2000
fgsearch.ColWidth(3) = 2550
fgsearch.ColWidth(4) = 2000
fgsearch.ColWidth(5) = 4000

fgsearch.TextMatrix(0, 0) = "Sr. No."


fgsearch.TextMatrix(0, 1) = "Book Name"
fgsearch.TextMatrix(0, 2) = "Edition"
fgsearch.TextMatrix(0, 3) = "Author"
fgsearch.TextMatrix(0, 4) = "Access No"
fgsearch.TextMatrix(0, 5) = "Place"

Do While rsavai.EOF = False


If txtsearch.Text = rsavai.Fields("Book Name").Value _
Or txtsearch.Text = rsavai.Fields("Author").Value _
Or txtsearch.Text = rsavai.Fields("AccessNo").Value
Then

fgsearch.TextMatrix(r, 0) = r
c=1
fgsearch.TextMatrix(r, c) = rsavai.Fields("Book
Name").Value
c=c+1
fgsearch.TextMatrix(r, c) =
rsavai.Fields("Edition").Value
c=c+1
fgsearch.TextMatrix(r, c) =
rsavai.Fields("Author").Value
c=c+1
fgsearch.TextMatrix(r, c) =
rsavai.Fields("AccessNo").Value
c=c+1
fgsearch.TextMatrix(r, c) =
rstotal.Fields("Place").Value

r=r+1
fgsearch.Rows = fgsearch.Rows + 1
rsavai.MoveNext
Else
rsavai.MoveNext
End If
Loop
End If
rsavai.MoveFirst

End Sub

EDIT RULES & REGULATIONS

Dim rsrule As ADODB.Recordset


Dim sqlrule As String
Dim rule As String

Private Sub cmdaddrule_Click()

If txtaddrule.Text <> "" Then


listrules.AddItem txtaddrule.Text
sqlrule = "insert into rulesreg values ('" & txtaddrule.Text
& "')"
con.Execute (sqlrule)
End If

End Sub
Private Sub cmddeleterule_Click()
Dim str As String
Dim i As Integer
Dim j As Integer
Dim k As Integer

k = listrules.ListCount - 1
For i = 0 To k
If listrules.Selected(i) Then
str = listrules.List(i)
listrules.RemoveItem (i)

sqlrule = "delete from rulesreg where RULE = '" & str &
"' "
con.Execute (sqlrule)

i = -1
k=k-1
End If
If k = i Then
Exit Sub
End If
Next

End Sub
Private Sub Form_Load()
Set rsrule = New ADODB.Recordset

rsrule.Open "select * from rulesreg", con, 3, 3


sqlrule = "select * from rulesreg"

Set rsrule = con.Execute(sqlrule)

While Not rsrule.EOF


rule = rsrule.Fields("RULE").Value
listrules.AddItem rule
rsrule.MoveNext
Wend

End Sub

HELP
ABOUT LIBRARY SYSTEM

SUPPORTS
• Mastering Visual Basic 6.0
• Visual Basic Programming Black Book
• MSDN Library
• Microsoft Windows Access 2003 Help

You might also like