You are on page 1of 81

http://www.chetanasprojects.

com

PROJECT REPORT ON

Library Management System

ACKNOWLEDGEMENT

I take this precious opportunity to express my


gratitude toward “LIBRARY MANAGEMENT
SYSTEM” to grant is permission for under going the
training project. Without it’s willingness to permit
this project would not have been succeed.

First of all, I would like to thanks all those


people who helped me directly or indirectly to
complete my project whenever I found my self in
problems. Our all faculties encourages me and due to
their kindness and helpful nature and help I got very
much confidence to complete this project.

I am deeply inherited who devoted his precious


time in giving me the information about the various
aspect and gave support and guidance at every point
of time. I am really thankful to their kind and

http://www.chetanasprojects.com
supportive nature. His inspiring nature has always
made my work easy.

Last but not least, I would like to express my


gratitude to those persons who directly or indirectly
helped in my project.

PREFACE
The field of computer education has witnessed a
sea change since the discovery of simple calculating
machine by CHARLES BABAGE. The era is
confronting with the speed and mind of computer, i.e.
the speed and intelligence have become vital. At one
end they are competing with each other. Not only
these computers have immensely benefited the
mankind in the field of planning. The wheel of
progress is rolling with much faster speed then it used
to be a decade ago; thank to the revolution ushered in
by computer. But all this haven’t come as easy as it
appears to be rather it requires planning strategy and a
lot of brain storming before a package is developed or
a language is born.
Since the prime task of the computer is to
process a raw data into useful information, we can
ignore the basic step of information collection ret
rival and processing at our risk only. The importance
of finding the right information in the possible least
time as well know to us.

ABSTRACT
Maintaining records of application for estates, the
manual system is too complex and cumbersome.
Since time and resources available we have been
proposed to develop an inventory system.

All the outset the application requirements were


studied and analysis and design were carried out. The
development platform and software tool were
identified as Visual Basic 6.0 (As Front-End) and
Access (As Back-End) database. Using visual
programming, object are manipulated directly and
also due to the feature of fast and easy prototyping
and GUI building visual basic 6.0 as used.
In the system analysis and design part, data is
processed using query techniques and study of the
existing system.

During the development phase various option are


developed like master menu. transaction menu, report
generation, utility etc.

The detail of the programming steps followed


and important clauses incorporated in the screen are
described in documents.

Why Visual Basic Programming

Using visual programming objects are


manipulated directly, By Highlighting; point and
cliking specific properties can relate to physical
appearance (color, shading, fonts, size and so on).
Most widely used objects oriented, graphical
programming language for window development are:

Visual Basic

Power Builder

Forms 5.0 / 6.0


We have selected one of the most widely
used object oriented, graphical programming
language for window development Visual Basic.
Selection of visual basic based on following
strengths:

 Fast and easy prototyping and GUI building.

 Fully functional, real window application


building.

 Excellent DDE and DDL support and client


OLE.

 MDI support.

 Easy Dialog Box Construction.

 Easy Menu Generation supporting Short –


cut key.

INTRODUCTION OF VISUAL BASIC

Visual Basic Editions:


Visual Basic is available in three versions, each
generate to meet a specific set of development
requirement.

 The visual basic learning edition.

 The professional edition.

 The enterprise edition.

VISUAL BASIC AND DATABASE

Visual Basic can be used to build very complex


application. Visual Basic effective software that can
perform all essential management function. It can be
used to:

 Create data table and store data in them.

Edit data records.

Retrieve data selectively from stored records


to provide specific information.

Prepare printed information retrieval reports.


Perform calculation.

 Create screens that can interact with users.

Visual Basic provides a wide verity of data


access alternatives, for working with local and remote
database, including enterprise level three-tiered
client/server application.

-: INTRODUCTION TO ACCESS :-

Database : What they are? And how they work?

A database is collection of information related to


particular or purpose such as tracking customer orders
or maintaining a music collection. If your database
isn’t stored on a computer or only parts of it are, you
may be tracking information from variey of source
that you have to coordinate and organize your self.

Using it, you can manage all our information


from single database file. Within file divide your data
using into separate storage containers called tables;
view, add, and update table data using forms; find and
retrieve just the data you want using queries and
analyze or print data in specific layout using reports.

To find and retrieve just data that meet condition


you specify including data from multiple tables create
a query. A query can also update multiple records at
the same time and perform built-in or custom
calculations on your data. To easily view, enter and
change directly in a table, create a form. When you
open a form, it retrives the data from one or more
tables and display it on screen using the data from
you chose in the form using a layout that you creted
from scratch.
To analyze your data present it a certain way
in print, create a report. For exmple, you might print
one report that raw material and calculates totals.

TABLES :

A tables is a collection of data about a


specific topic, such as products or suppliers. Using as
separate table for each topic means you store that data
only once which makes your database more efficient
and reduces dataentry errors. Table organize data into
columns and rows.

In table datasheet view, you can add, edit or


view the data in a table. You can also check the
spelling and print your tables data filter or sort
records change the datasheet’s appearance or change
the table’s structure by adding or deleting columns.
You can create an entire table from scratch, or add,
delete, or customize an existing tables fields.

QUERIES:

You use queries to view, change and analyze


data in different ways. You can also use them as the
source of records for froms and report. The most
common type of query is a select query. A select
query retrieves data from one or more tables using
criteria you specify and then display it in the order
you want.

ADVANTAGES OF ACCESS :-

 More Reliable than other RDBMS.

 Easy to use and learn.

 Data security is high.


 Updating database.

 Support ODBC , ADO data


programming objects.

Disadvantages of Manual System:-

 The manual system required more time


for processing.

 The processing is very lengthy.

 It require more clerical work.

 The manual system is more error prone.

 Manual system is costly.

 Immediate response to the quires is


difficulty and time consuming.

 It is not possible to create quick report.


 Mathematical calculation done
manfully.

 No authentication measures.

Need for computerized system:-

The main draw back of the existing system is that


manual work leads time consumption. It affects the all
person of management and also the departments.
There is number of day-by-day transactions and hence
the large number of register have to the kept to
circulation, which have to the stored. Also large
numbers of register have to the kept to the store. This
document is required more storing space, more
manpower and job become tedious. Sometime
gathering of all documents is a tedious job.

In this system process of summary report in


main part, using the computerized system this process
is become simple and small. You can immediately
getting the report for the query. You can get this all
report or summary for the previous year. Various
year. Various details have to the providing to the
management at any time.
System Attributes And Quality
Characteristic:

Security:-

The system is designed keeping in view that


chances of unauthorized use are made neligible. In the
design depending upon the user, they are entitled with
specific required right only. Only the Administrator
will be able to create new users. He is the only person
having full access of main database. As sequrity is a
crucial characteristic, it is treated according in this
system.

Portability:-

The designed system must operate on different


version of OS viz. Windows 98, NT, XP etc. Proper
care is taken at the time of design and coding so that
it
will execute and run property. To assure portability of
the system, backward compatibility up to a certain
level will also be maintained.

Reliability:-

Following tests will be performed to assure


reliability of the system.

 Simulation Test.

 Memory Test.

 Path Test.

 Loop Test.

 Random Data Test.

 OS Compatibility Test.

 Hardware Compatibility Test.

 Data Test.
The above listed test are carried out at development
site, installation site and during the development
process as per the requirement. The multiple waterfall
modules during the development of the project will
assure minimum risk.

Application Requirement:

User Platform: PC/Pentium

Operating System: Windows2000

Development Tools: Visual Basic6.0

Database: Access
ACCESS TABLE’S DETAIL’S:

TABLE – 1 : LOGIN_MAST (User


Information)

FIELD NAME DATA TYPE & DESCRIPTION


(SIZE)
Usr Text (20) User Name
Pw Text (20) User Password
Typ Text (1) Type of User
TABLE=>2 BOOK_MAST (Store Book
FIELD NAME DATA TYPE & DESCRIPTION
(SIZE)
Code Text (6) Book/CD Code
Title Text (30) Title of Book/Cd
Author Text (20) Auther of book(s)
Publisher Text (20) Publisher of Book
Pur_Dt Date/Time Purchase Date
Price Currency Price of Book/Cd
(Standard)
Qty Number (Long int.) Book/Cd Quantity
Pur_From Text (50) Purchase From
IsudBk Number (Long int) Quantity of issued
Book/cd
details)

TABLE=>3 MBR_MAST (Store Master


details)
FIELD NAME DATA TYPE & DESCRIPTION
(SIZE)
Code Text (10) Member No
Surname Text (50) Surname
Member Text (50) Member Name
Father Text (50) Father Name
Join_Dt Date/Time Join Date
Address Memo Member Address
City Text (20) City
Crs Text (10) Course
Yer Text (10) Year of Course(FY,
SY, TY,
SEM1,etc...)
Cnt_No Text (50) Contect Number
Gender Text (1) Sex
Fee Currency Membership Fee
(Standard)
Fine Currency Fine on late
(Standard) submission

TABLE=>4 FINE_MAST (Store Fine detail)


FIELD NAME DATA TYPE DESCRIPTION
Crs Text (10) Course
Yer Text (10) Year of study
Mbr_No Text (6) Member Number
Bk_No Text (6) Book Number
Fine Currency Fine for late
(Standard) submission, Datmage
etc...
Fin_Dt Date/Time Date of Fine
TABLE=>5 ISSUE_MAST (Store Issue
Details)

FIELD NAME DATA TYPE & DESCRIPTION


(SIZE)
Mbr_No Text (6) Member No
Crs Text (10) Student Course or Staff
Yer Text (10) Year of Study
Bk_No Text (6) Book No.
Isu_Dt Date/Time Issue Date
Lst_Dt Date/Time Last Submit Date

V.B.
FORM
DESIGN
&
CODDING

FORM - 1 : WELCOME FORM


(FrmWelcome.frm)
CODE : WELCOME FORM (FrmWelcome.frm)
Private Sub Form_Resize( )

Img1.Height = Me.ScaleHeight
Img1.Width = Me.ScaleWidth

LblWelcome1.Left = (Me.ScaleWidth / 2 -
LblWelcome1.Width / 2) - 120
LblWelcome2.Left = Me.ScaleWidth / 2 - LblWelcome2.Width
/2

LblRpbc1.Left = (Me.ScaleWidth / 2 - LblRpbc1.Width / 2) +


60
LblRpbc2.Left = Me.ScaleWidth / 2 - LblRpbc1.Width / 2

LblLib1.Left = Me.ScaleWidth / 2 - LblLib1.Width / 2


LblLib2.Left = (Me.ScaleWidth / 2 - LblLib2.Width / 2) + 60

LblSys1.Left = Me.ScaleWidth / 2 - LblSys1.Width / 2


LblSys2.Left = (Me.ScaleWidth / 2 - LblSys2.Width / 2) + 60

End Sub

Private Sub Img1_Click( )


FrmLogin.Show
Timer1.Enabled = False
End Sub

Private Sub LblWelcome1_Click( )


FrmLogin.Show
Timer1.Enabled = False
End Sub

Private Sub Timer1_Timer( )


FrmLogin.Show vbModal
Timer1.Enabled = False
End Sub
FORM - 2 : LOGIN FORM (FrmLogin.frm)

CODE : LOGIN FORM (FrmLogin.frm)

Dim rs_user As New Recordset

Private Sub CmdCancel_Click()


End
End Sub
Private Sub CmdLogin_Click()
bkType = "BOOK"
userType = "L"
Class = "BBA": Yer = "FY"

If Trim(TxtUser) = "" And Trim(TxtPwd) = "" Then


MsgBox "Fill all the details", vbInformation, "Login"
TxtUser.SetFocus
Exit Sub
End If

If TxtUser = "LIBRARY" And TxtPwd = "INDISOFT" Then


userType = "L"
userNm = "LIBRARY"
Unload FrmWelcome
Unload FrmLogin
MDIFrm.Show
Exit Sub
End If

If rs_user.RecordCount <> 0 Then


rs_user.MoveFirst
rs_user.Find "usr = '" & TxtUser & "'"
If Not rs_user.EOF Then
If rs_user.Fields(1) = TxtPwd Then
userType = rs_user.Fields(2)
userNm = rs_user.Fields(0)
Unload FrmWelcome
Unload FrmLogin
MDIFrm.Show
Exit Sub
Else
MsgBox "Wrong username or password.", vbCritical,
"Login"
TxtUser.SetFocus
Exit Sub
End If
Else
MsgBox "Wrong username or password.", vbCritical,
"Login"
TxtUser.SetFocus
Exit Sub
End If
Else
MsgBox "Wrong username or password.", vbCritical,
"Login"
TxtUser.SetFocus
Exit Sub
End If

End Sub

Private Sub Form_Load()

'OPEN RECORDSET
rs_user.Open "select * from Login_Mast", conn,
adOpenStatic, adLockPessimistic

End Sub

Private Sub Form_Unload(Cancel As Integer)


rs_user.Close
End Sub

Private Sub TxtPwd_GotFocus()


Call selectTxt(TxtPwd)
End Sub

Private Sub TxtPwd_KeyPress(KeyAscii As Integer)


If KeyAscii = 39 Then
KeyAscii = 0
End If
KeyAscii = upper(KeyAscii)
End Sub

Private Sub TxtUser_GotFocus()


Call selectTxt(TxtUser)
End Sub

Private Sub TxtUser_KeyPress(KeyAscii As Integer)


If KeyAscii = 39 Then
KeyAscii = 0
End If
KeyAscii = upper(KeyAscii)
End Sub
FORM – 3 : MDI FORM (MDIFrm.frm)
FORM – 3 : MDI FORM (MDIFrm.frm)

Option Explicit

Dim rs As New ADODB.Recordset


Dim FL As String 'TO STORE FILE NAME
Dim rpt As String

Private Sub CmdBkEntry_Click()


Call MnuBkOpr_Click
End Sub

Private Sub CmdBkRpt_Click()


Dim str As String

str = InputBox("Enter BOOK for Book report and CD for Cd


report", "Report Creation", "BOOK")

If str = "BOOK" Then

Call MnuBkRpt_Click
ElseIf str = "CD" Then
Call MnuCdRpt_Click
Else
MsgBox "Invalid input.", vbCritical, "Report Creation"
End If

End Sub
Private Sub CmdBkSubISu_Click()
Call MnuBkIsuSub_Click
End Sub

Private Sub CmdExit_Click()


End
End Sub

Private Sub CmdIsuDtl_Click()


Call MnuBkIsuDtl_Click
End Sub

Private Sub CmdIsuRpt_Click()


Call mnuIsuRpt_Click
End Sub

Private Sub CmdMbrEntry_Click()


Call MnuMbrOpr_Click
End Sub

Private Sub CmdMbrRpt_Click()


Call MnuMbrRpt_Click
End Sub

Private Sub CmdUAcc_Click()


Call MnuUmgAcc_Click
End Sub

Private Sub LblClose_Click()


Pct1.Visible = False
End Sub

Private Sub MDIForm_Load()

'CHECK USER TYPE


If userNm = "LIBRARY" Then
MnuUmg.Enabled = False
CmdUAcc.Enabled = False
End If

If userType = "L" Then


MnuBkIsuSub.Enabled = False
MnuRpt.Enabled = False

CmdBkSubISu.Enabled = False
End If

End Sub

Private Sub MDIForm_Resize()


'RESIZE STATUS BAR
If Me.Width > 1000 And Me.Height > 1000 Then
StatusBar1.Panels(1).Width = Me.ScaleWidth * 0.5
StatusBar1.Panels(2).Width = Me.ScaleWidth * 0.11
StatusBar1.Panels(3).Width = Me.ScaleWidth * 0.11
StatusBar1.Panels(4).Width = Me.ScaleWidth * 0.11
StatusBar1.Panels(5).Width = Me.ScaleWidth * 0.11
StatusBar1.Panels(6).Width = Me.ScaleWidth * 0.05
StatusBar1.Panels(1) = "Current User : " & userNm & "(" &
userType & ")"

End If

'ARRANGE PICTURE BOX AND OTHER COMMAND


BUTTONS
Pct1.Height = Me.Height

If Me.Height >= 8100 And Me.Width >= 11500 Then

'MAKE LABLE TO CENTER


LblTask.Left = Me.ScaleWidth / 2 - LblTask.Width / 2

'SET ALL COMMAND BUTTONS AND FRAME


CmdUAcc.Left = Me.ScaleWidth / 2 - CmdUAcc.Width / 2

FramIsu.Left = Me.ScaleWidth / 2 - FramIsu.Width / 2


FramMbr.Left = FramIsu.Left - FramMbr.Width - 500
FramBk.Left = FramIsu.Left + FramIsu.Width + 500

'SET COMMAND BUTTON TO CENTER


CmdExit.Left = Me.ScaleWidth / 2 - CmdExit.Width / 2

LblClose.Top = Me.Height - 1500


LblClose.Left = Me.ScaleWidth - 2500
End If

End Sub

Private Sub MDIForm_Unload(Cancel As Integer)


End
End Sub

Private Sub MnuAbtLib_Click()


Pct1.Visible = False
frmAbout.Show vbModal
End Sub

Private Sub MnuBkIsuDtl_Click()


Pct1.Visible = False
FrmIsuDtl.Show
End Sub

Private Sub MnuBkIsuSub_Click()


Pct1.Visible = False
FrmBookIsu.Show
End Sub

Private Sub MnuBkOpr_Click()


Pct1.Visible = False
frmBkEntry.Show
End Sub

Private Sub MnuBkRpt_Click()


Call BookCdReport("BOOK") 'GENERATE REPORT
End Sub

Private Sub MnuCdRpt_Click()


Call BookCdReport("CD") 'GENERATE REPORT
End Sub

Private Sub mnuIsuRpt_Click()


Pct1.Visible = False

Report = "I" 'I means Issue Report


FrmRpt.Show vbModal
End Sub

Private Sub MnuMbrOpr_Click()


Pct1.Visible = False
FrmMember.Show
End Sub

Private Sub MnuMbrRpt_Click()


Pct1.Visible = False
Report = "M" 'M means Member Report
FrmRpt.Show vbModal
End Sub

Private Sub MnuMstrSelection_Click()


Pct1.Visible = True
End Sub

Private Sub MnuUmgAcc_Click()


Pct1.Visible = False
FrmUserMng.Show vbModal
End Sub

Private Sub MnuWinClose_Click()


Do While Forms.Count - 1 > 0
Unload Me.ActiveForm
Loop
End Sub
Private Sub MnuWinCscd_Click()
Arrange vbCascade
End Sub

Private Sub MnuWinHrz_Click()


Arrange vbHorizontal
End Sub

Private Sub MnuWinVrtl_Click()


Arrange vbVertical
End Sub

'================================================
==='GENERATE REPORT FOR BOOK/CD (PROCEDURE)

Private Sub BookCdReport(typ As String)


Set rs = New Recordset

If typ = "BOOK" Then

rs.Open "SELECT Code,Title,Author,Price,Qty FROM


Book_Mast WHERE Code like 'B%'", conn,
adOpenStatic, adLockReadOnly
Else

rs.Open "SELECT Code,Title,Author,Price,Qty FROM


Book_Mast WHERE Code like 'C%'", conn,
adOpenStatic, adLockReadOnly

End If

'WHEN NO RECORD EXIST


If rs.RecordCount = 0 Then
rs.Close
MsgBox "No record is found.", vbInformation, "Member
Report"
Exit Sub
End If

'CREATE REPORT
'OPEN FILE
FL = typ & "_" & Format(Date, "dd-mm-yyyy")
Open App.Path & "\Reports\" & FL & ".txt" For Output As #1

Print #1, ""


Print #1,
"
"

If typ = "BOOK" Then


Print #1, "---------------------------- B O O K S R E P O R T
"
Else
Print #1, "------------------------------- C D R E P O R T
"
End If

Print #1,
"
"
Print #1, ""
Print #1, " Date : " & Format(Date, "dd-mm-yyyy")
Print #1, ""
Print #1,
"
"
Print #1, " CODE TITLE AUTHOR
PRICE QUANTITY "
Print #1,
"
"

rs.MoveFirst
Do While Not rs.EOF
Print #1, " " & rs!Code & " " & _
rs!title & Space(31 - Len(rs!title)) & _
rs!Author & Space(22 - Len(rs!Author)) & _
Space(6 - Len(rs!Price)) & rs!Price & _
Space(11 - Len(rs!qty)) & rs!qty
Print #1, ""
rs.MoveNext
Loop
rs.Close

Close #1
MsgBox FL & ".txt created successfully.", vbInformation,
"Member Report"

Shell App.Path & "\Reports\wordpad.exe " & App.Path &


"\Reports\" & FL & ".txt", vbMaximizedFocus

End Sub

FORM – 4 : USER MANAGEMENT


(FrmUserMng)
CODE : USER MANAGEMENT
(FrmUserMng.frm)
Private Sub CmdCancel_Click()
Unload Me
End Sub

Private Sub CmdCreateAcc_Click()


Unload Me
FrmCreateAcc.Show vbModal
End Sub

Private Sub CmdDeleteAcc_Click()


Unload Me
FrmUserDelete.Show vbModal
End Sub

Private Sub CmdEditAcc_Click()


Unload Me
FrmEditAcc.Show vbModal
End Sub

Private Sub Form_Load()


If userType = "L" Then
CmdCreateAcc.Enabled = False
CmdDeleteAcc.Enabled = False
End If
End Sub

Private Sub Form_Unload(Cancel As Integer)


If Forms.Count = 2 Then
MDIFrm.Pct1.Visible = True
End If
End Sub
FORM – 5 : CREATE NEW USER
(FrmCreateAcc)
CODE : CREATE NEW USER (FrmCreateAcc)

Dim rs_user As New ADODB.Recordset

Private Sub CmdBack_Click()


Unload Me
FrmUserMng.Show vbModal
End Sub

Private Sub CmdCancel_Click()


Unload Me
End Sub

Private Sub CmdCreateAcc_Click()


Dim Query As String, typ As String

If Trim(TxtUser.Text) = "" Or Trim(TxtPwd) = "" Or


Trim(TxtConfPwd) = "" Then

MsgBox "All fields are compulsory.", vbInformation,


"User Addition"
Exit Sub

ElseIf Trim(TxtPwd) <> Trim(TxtConfPwd) Then

MsgBox "Your confirm password do not match." & vbCrLf


&_
"Type your confirm password again.", vbCritical, "User
Addition"

TxtConfPwd.SetFocus
Exit Sub

End If
'DUPLICATION CHECK
rs_user.MoveFirst
rs_user.Find "usr='" & TxtUser & "'"

If rs_user.EOF Then 'USER NOT EXIST


If CmbUserType.Text = "ADMIN" Then
typ = "A"
Else
typ = "L"
End If

Query = "insert into Login_Mast values ('" & TxtUser & "','"
&_
TxtPwd & "','" & typ & "')"
MsgBox Query
conn.Execute Query
MsgBox "New user is successfully added.", vbInformation,
"User Addition"
TxtUser = ""
TxtPwd = ""
TxtConfPwd = ""
CmbUserType.SetFocus
Call Form_Load

Else 'USER IS ALREADY EXIST


MsgBox "User already exit. Enter another user name.",
vbCritical, "User Additon"
TxtUser.SetFocus
End If

End Sub

Private Sub Form_Load()

MDIFrm.Pct1.Visible = False

'OPEN RECORDSET
If rs_user.State = 1 Then rs_user.Close
rs_user.Open "select * from Login_Mast", conn,
adOpenStatic, adLockPessimistic

'CLEAR TEXT BOX


TxtUser.Text = ""
TxtPwd.Text = ""
TxtConfPwd.Text = ""

CmbUserType.Text = CmbUserType.List(0)
End Sub

Private Sub Form_Unload(Cancel As Integer)


rs_user.Close
End Sub

Private Sub TxtConfPwd_GotFocus()


Call Book.selectTxt(TxtConfPwd)
End Sub

Private Sub TxtConfPwd_KeyPress(KeyAscii As Integer)


If KeyAscii = 39 Or KeyAscii = 34 Or KeyAscii = 32 Then
KeyAscii = 0
End If
KeyAscii = Book.upper(KeyAscii)
End Sub

Private Sub TxtPwd_GotFocus()


Call Book.selectTxt(TxtPwd)
End Sub

Private Sub TxtPwd_KeyPress(KeyAscii As Integer)


If KeyAscii = 39 Or KeyAscii = 34 Or KeyAscii = 32 Then
KeyAscii = 0
End If
KeyAscii = Book.upper(KeyAscii)
End Sub

Private Sub TxtUser_GotFocus()


Call Book.selectTxt(TxtUser)
End Sub

Private Sub TxtUser_KeyPress(KeyAscii As Integer)


If KeyAscii = 39 Or KeyAscii = 34 Or KeyAscii = 32 Then
KeyAscii = 0
End If
KeyAscii = Book.upper(KeyAscii)
End Sub

FORM – 5 : CHANGE USER NAME


(FrmEditAcc)
FORM - 6 : CHANGE PASSWORD
(FrmEditAcc)
CODE – 5 : CHANGE USER NAME &
CHANGE PASSWORD
(FrmEditAcc)
Dim rs_user As New ADODB.Recordset
Dim Query As String

Private Sub CmdBack_Click()


Unload Me
FrmUserMng.Show vbModal
End Sub

Private Sub CmdCancel_Click()


Unload Me
End Sub

Private Sub CmdPwd_Click()


'CHECKING FOR BLANCK TEXT BOXES
If Trim(TxtUser) = "" Or Trim(TxtCurPwd) = "" Or
Trim(TxtNewPwd) = "" Or Trim(TxtConfPwd) = "" Then

MsgBox "All fields are compulsory.", vbInformation,


"Change Password"
Exit Sub
End If

'CHECKING FOR NEW PASSWORD & CONF. PASSWORD


MATCHING
If TxtNewPwd <> TxtConfPwd Then
MsgBox "Your confirm password do not match." & vbCrLf
& "Enter confirm password again.", vbCritical,
"Change Password"
Exit Sub
End If

If userType = "A" Then


'WHEN USER IS ADMIN
'FIND USER IS EXIST OR NOT
rs_user.MoveFirst
rs_user.Find "usr='" & TxtUser & "'"

If rs_user.EOF Then 'USER NOT EXIST


MsgBox "User name does not exixt." & vbCrLf & _
"Enter current name again.", vbCritical, "Change
Password"
TxtUser.SetFocus
Exit Sub
End If

'IF USER AND PASSWORD NOT MATCH


If rs_user.Fields(1) <> TxtCurPwd Then
MsgBox "Your current password do not match. Enter it
again.", vbCritical, "Change Password"
TxtCurPwd.SetFocus
Exit Sub
End If

Query = "update Login_Mast set pw='" & TxtNewPwd &


"' where usr='" & TxtUser & "'"

Else

'WHEN USER IS LIMITED


If TxtUser <> userNm Then
MsgBox "Your user name not match. Enter it again.",
vbCritical, "Change Password"
Exit Sub
End If

rs_user.MoveFirst
rs_user.Find "usr='" & TxtUser & "'"

'IF USER AND PASSWORD NOT MATCH


If rs_user.Fields(1) <> TxtCurPwd Then
MsgBox "Your current password do not match. Enter it
again.", vbCritical, "Change Password"
TxtCurPwd.SetFocus
Exit Sub
End If

Query = "update Login_Mast set pw='" & TxtNewPwd &


"' where usr='" & TxtUser & "'"

End If

'UPDATE PASSWORD
conn.Execute Query
MsgBox "Your password is changed successfully.",
vbInformation, "Change Password"

TxtUser.Text = ""
TxtCurPwd.Text = ""
TxtNewPwd.Text = ""
TxtConfPwd.Text = ""
TxtUser.SetFocus

End Sub

Private Sub CmdUser_Click()

Dim typ As String


typ = userType

If Trim(TxtCurUser) = "" Or Trim(TxtNewUser) = "" Then


MsgBox "All fields are compulsory.", vbInformation,
"Change User"
Exit Sub
End If

If userType = "A" Then


'WHEN USER IS ADMIN
'FIND USER IS EXIST OR NOT
rs_user.MoveFirst
rs_user.Find "usr='" & TxtCurUser & "'"

If rs_user.EOF Then 'USER NOT EXIST


MsgBox "User name does not exixt." & vbCrLf & _
"Enter current name again.", vbCritical, "User Edition"
TxtCurUser.SetFocus
Exit Sub
End If

If CmbUserType.Text = "ADMIN" Then


typ = "A"
Else
typ = "L"
End If

'WHEN CURRENT USER IS CHANGING ACCOUNT


If (TxtCurUser = userNm) And (userType <> typ) Then
MsgBox "You can not change your account type." &
vbCrLf & _
"Login with another Admin user and then change your
account type.", vbInformation, "User Edition"
Exit Sub
End If

Query = "update Login_Mast set usr='" & TxtNewUser &


"',typ='" & _
typ & "' where usr='" & TxtCurUser & "'"

Else

'WHEN USER IS LIMITED


If userNm <> TxtCurUser Then
MsgBox "Your current name is not correct." & vbCrLf & _
"Enter current name again.", vbCritical, "User Edition"
TxtCurUser.SetFocus
Exit Sub
End If

Query = "update Login_Mast set usr='" & TxtNewUser & "'


where usr='" & userNm & "'"

End If
'CHECK FOR DUPLICATE RECORD
rs_user.MoveFirst
rs_user.Find "usr='" & TxtNewUser & "'"

If (rs_user.EOF = False) And (userNm <> TxtNewUser) Then


MsgBox "User already exixt. Enter another user name.",
vbCritical, "User Edition"
Exit Sub
End If

'EXECUTE QUERY & UPDATE RECORD


conn.Execute Query
MsgBox "User name is changed successfully.",
vbInformation, "User Edition"

If TxtCurUser = userNm Then


userNm = TxtNewUser.Text
userType = typ
MDIFrm.StatusBar1.Panels(1) = "Current User : " &
userNm & "(" & userType
& ")"

End If

TxtCurUser.Text = ""
TxtNewUser.Text = ""
TxtCurUser.SetFocus

End Sub

Private Sub Form_Load()


MDIFrm.Pct1.Visible = False

Call TabEditAcc_Click(0) 'SELECT TAB 1

'CLOSE RECORDSET IF OPEN


If rs_user.State = 1 Then rs_user.Close
'OPEN RECORDSET
rs_user.Open "select * from Login_Mast", conn,
adOpenStatic, adLockPessimistic

End Sub

Private Sub TabEditAcc_Click(PreviousTab As Integer)

If TabEditAcc.Tab = 0 Then
FremEditPwd.Enabled = False
FremEditUser.Enabled = True
CmdUser.Default = True

'CmbUserType.Text = CmbUserType.List(0)
TxtCurUser = ""
TxtNewUser = ""

If userType = "L" Then


CmbUserType.Enabled = False
CmbUserType.Text = "LIMITED"
Else
CmbUserType.Text = "ADMIN"
End If

Else
FremEditPwd.Enabled = True
FremEditUser.Enabled = False
CmdPwd.Default = True

TxtUser = "": TxtCurPwd = ""


TxtNewPwd = "": TxtConfPwd = ""
End If

End Sub

Private Sub TxtConfPwd_GotFocus()


Call Book.selectTxt(TxtConfPwd)
End Sub

Private Sub TxtConfPwd_KeyPress(KeyAscii As Integer)


If KeyAscii = 39 Or KeyAscii = 34 Or KeyAscii = 32 Then
KeyAscii = 0
End If
KeyAscii = Book.upper(KeyAscii)
End Sub

Private Sub TxtCurPwd_GotFocus()


Call Book.selectTxt(TxtCurPwd)
End Sub

Private Sub TxtCurPwd_KeyPress(KeyAscii As Integer)


If KeyAscii = 39 Or KeyAscii = 34 Or KeyAscii = 32 Then
KeyAscii = 0
End If
KeyAscii = Book.upper(KeyAscii)
End Sub

Private Sub TxtCurUser_GotFocus()


Call Book.selectTxt(TxtCurUser)
End Sub

Private Sub TxtCurUser_KeyPress(KeyAscii As Integer)


If KeyAscii = 39 Or KeyAscii = 34 Or KeyAscii = 32 Then
KeyAscii = 0
End If
KeyAscii = Book.upper(KeyAscii)
End Sub

Private Sub TxtNewPwd_GotFocus()


Call Book.selectTxt(TxtNewPwd)
End Sub

Private Sub TxtNewPwd_KeyPress(KeyAscii As Integer)


If KeyAscii = 39 Or KeyAscii = 34 Or KeyAscii = 32 Then
KeyAscii = 0
End If
KeyAscii = Book.upper(KeyAscii)
End Sub

Private Sub TxtNewUser_GotFocus()


Call Book.selectTxt(TxtNewUser)
End Sub

Private Sub TxtNewUser_KeyPress(KeyAscii As Integer)


If KeyAscii = 39 Or KeyAscii = 34 Or KeyAscii = 32 Then
KeyAscii = 0
End If
KeyAscii = Book.upper(KeyAscii)
End Sub

Private Sub TxtUser_GotFocus()


Call Book.selectTxt(TxtUser)
End Sub

Private Sub TxtUser_KeyPress(KeyAscii As Integer)


If KeyAscii = 39 Or KeyAscii = 34 Or KeyAscii = 32 Then
KeyAscii = 0
End If
KeyAscii = Book.upper(KeyAscii)
End Sub
FORM – 7 : DELETE USER (FrmUserDelete)
CODE : DELETE USER (FrmUserDelete)

Dim rs_user As New ADODB.Recordset


Dim rs_tmp As New ADODB.Recordset

Private Sub CmdBack_Click()


Unload Me
FrmUserMng.Show vbModal
End Sub

Private Sub CmdCancel_Click()


Unload Me
End Sub

Private Sub CmdDelete_Click()


Dim Query As String, cnt As Integer

'CHECK FOR RECORDSET IS OPEN OR CLOSED


If rs_tmp.State = 1 Then
rs_tmp.Close
End If

rs_tmp.Open "select * from Login_Mast where Typ='A'",


conn, adOpenStatic, adLockPessimistic
If (rs_tmp.RecordCount = 1) And (Mid(LstUserDelete.Text,
Len(LstUserDelete.Text) - 1, 1) = "A") Then

MsgBox "You can not delete this Admin user." & vbCrLf &
"Atlist one Admin user is required.", vbCritical,
"User Deletion"
Exit Sub
End If

If MsgBox("You want to delete selected user ?", vbQuestion +


vbOKCancel, "User Deletion") = vbOK Then
'FIND SELECTED USER
rs_user.MoveFirst
rs_user.Find "usr='" & Mid(LstUserDelete.Text, 1,
Len(LstUserDelete.Text) - 4) & "'"

rs_user.Delete 'DELETE USER

Call fillList 'FILL LIST BOX


End If

End Sub

Private Sub Form_Load()


MDIFrm.Pct1.Visible = False
'OPEN RECORDSET
rs_user.Open "select * from Login_Mast", conn,
adOpenStatic, adLockPessimistic

Call fillList 'FILL LIST BOX


End Sub

Private Sub Form_Unload(Cancel As Integer)


rs_user.Close
End Sub

Private Sub fillList()


'FILL ListBox
LstUserDelete.Clear
If rs_user.RecordCount <> 0 Then
rs_user.MoveFirst
While Not rs_user.EOF
LstUserDelete.AddItem rs_user.Fields(0) & " (" &
rs_user.Fields(2) & ")"
rs_user.MoveNext
Wend
LstUserDelete.Text = LstUserDelete.List(0)
End If
End Sub

FORM – 8 : MEMBER OPERATION


(FrmMember)
CODE : MEMBER OPERATION (FrmMember)

Option Explicit

Dim rs_mbr As New ADODB.Recordset


Dim rs_temp As New ADODB.Recordset
Dim rs_isu As New ADODB.Recordset
Dim cmd As String

Private Sub CmbClass_Click()


Dim i As Integer

Class = CmbClass.Text
Call fillYear(Me) 'SELECT YEAR
CmbClassYear.Text = CmbClassYear.List(0)
End Sub

Private Sub CmbClassYear_Click()

Yer = CmbClassYear.Text

Call Member.controlEnable(Me, False)

If rs_mbr.State = 1 Then rs_mbr.Close


rs_mbr.Open "select * from Mbr_Mast where [crs]='" &
CmbClass.Text & _
"' and [Yer]='" & CmbClassYear.Text & "' ORDER BY
Code", conn, adOpenStatic, adLockPessimistic

Call Member.clearControl(Me) 'SET DEFAULT CONTROLS

If rs_mbr.RecordCount <> 0 Then


Call Book.enableCommand(Me) 'ENABLE COMMAND
BTNS
Call memberData(Me, rs_mbr) 'RETRIVE DATA
Else
Call Book.disableCommand(Me) 'DISABLE BUTTONS
CmdAdd.Enabled = True
End If

'CHECK USER TYPE


If userType = "L" Then
CmdAdd.Enabled = False
CmdEdit.Enabled = False
CmdDel.Enabled = False
CmdSave.Enabled = False
CmdTransfer.Enabled = False
End If

End Sub

Private Sub CmbMonth_Click()


Dim i As Integer
CmbDay.Clear
For i = 1 To daysOfMonth(Val(CmbMonth.Text),
Val(CmbYear.Text))
CmbDay.AddItem i
Next i
CmbDay.Text = Day(Date)
End Sub

Private Sub CmbSearch_Click()


Call fillMbrGrid(Me, CmbClass.Text, CmbClassYear.Text,
CmbSearch.Text)
End Sub

Private Sub CmbYear_Click()


Dim i As Integer
CmbDay.Clear
For i = 1 To daysOfMonth(Val(CmbMonth.Text),
Val(CmbYear.Text))

CmbDay.AddItem i
Next i
CmbDay.Text = Day(Date)
End Sub

Private Sub CmdAdd_Click()


Dim rs_tmp As New ADODB.Recordset
Set rs_tmp = New Recordset

cmd = "Add"
CmdExit.Caption = "&Cancel"
'ENABLE ALL CONTROLS
Call Member.controlEnable(Me, True)
TxtCode.Locked = True
CmdSave.Enabled = True 'ENABLE SAVE BUTTON
CmbClass.Enabled = False 'DISABLE CLASS COMBO
CmbClassYear.Enabled = False 'DISABLE YEAR COMBO
FremCategory.Enabled = False 'DISABLE SEARCH FREAM
Call Book.disableCommand(Me) 'DISABLE COMMAND
BTNS
CmdSave.Enabled = True

'SET DEFALUT CONTROLS


Call Member.clearControl(Me)

'GENERATE NEXT CODE


TxtCode.Text = Book.Next_Code(rs_mbr, "M")
TxtSurname.SetFocus

End Sub

Private Sub CmdDel_Click()

Set rs_temp = New Recordset


rs_temp.Open "SELECT * FROM Issue_Mast WHERE
[Crs]='" & CmbClass.Text & "' AND [Yer]='" &
CmbClassYear.Text & "' AND [Mbr_No]='" & TxtCode
& "' AND [Sub_Dt]='-'", conn, adOpenStatic,
adLockReadOnly

If rs_temp.RecordCount > 0 Then


MsgBox "You can't delete this member. First Issue
Book/CD.", vbInformation, "Member Deletion"
Exit Sub
End If

If MsgBox("You want to delete this record?", vbInformation +


vbYesNo, "Member deletion") = vbYes Then
rs_mbr.Delete 'DELETE RECORD
rs_mbr.Update 'UPDATE RECORD
rs_mbr.MoveNext 'MOVE RECORDSET TO NEXT
RECORD
Call Member.fillMbrGrid(Me, Class, Yer, CmbSearch.Text)

If rs_mbr.RecordCount = 0 Then

Call Member.clearControl(Me) 'CLEAR TEXT BOXES


Call Book.disableCommand(Me) 'DISABLE BUTTONS
CmdAdd.Enabled = True 'ENABLE ADD BUTTONS
Exit Sub

Else

If rs_mbr.EOF Then
rs_mbr.MoveFirst
'RETRIVE RECORD
Call Member.memberData(Me, rs_mbr)
Exit Sub
Else
'RETRIVE RECORD
Call Member.memberData(Me, rs_mbr)
End If
End If
End If

End Sub

Private Sub CmdEdit_Click()


cmd = "Edit"
CmdExit.Caption = "&Cancel"

'ENABLE ALL CONTROLS


Call Member.controlEnable(Me, True)
FremCategory.Enabled = False 'DISABLE SEARCH FREAM
Call Book.disableCommand(Me)
CmdSave.Enabled = True 'ENABLE SAVE BTN
End Sub

Private Sub CmdExit_Click()


If CmdExit.Caption = "&Cancel" Then
CmdExit.Caption = "E&xit"

'DISABLE ALL CONTROLS


Call Member.controlEnable(Me, False)
FremCategory.Enabled = True 'ENABLE SEARCH FREM

Call Member.clearControl(Me) 'CLEAR CONTROLS


If rs_mbr.RecordCount <> 0 Then
rs_mbr.MoveFirst
Call Book.enableCommand(Me) 'ENABLE BUTTON
'RETRIVE RECORD
Call Member.memberData(Me, rs_mbr)
Else
Call Book.disableCommand(Me) 'DISABLE BTNS
Call Member.clearControl(Me) 'CLEAR CONTROLS
CmdAdd.Enabled = True
End If

Call Member.controlEnable(Me, False) 'LOCK TEXT


BOXES
CmdSave.Enabled = False
CmbClass.Enabled = True 'ENABLE COURCE COMBO
CmbClassYear.Enabled = True 'ENABLE YEAR COMBO

ElseIf CmdExit.Caption = "E&xit" Then

Unload Me
End If

End Sub

Private Sub CmdFirst_Click()


rs_mbr.MoveFirst 'MOVE RECORD TO FIRST

'RETRIVE MEMBER DATA


Call Member.memberData(Me, rs_mbr)
End Sub

Private Sub CmdLast_Click()


rs_mbr.MoveLast 'MOVE RECORD TO FIRST
'RETRIVE MEMBER DATA
Call Member.memberData(Me, rs_mbr)
End Sub

Private Sub CmdNext_Click()


rs_mbr.MovePrevious
If rs_mbr.BOF Then
rs_mbr.MoveLast
End If
Call Member.memberData(Me, rs_mbr) 'RETRIVE DATA
End Sub

Private Sub CmdPrv_Click()


rs_mbr.MovePrevious
If rs_mbr.BOF Then
rs_mbr.MoveLast
End If
Call Member.memberData(Me, rs_mbr) 'RETRIVE DATA
End Sub

Private Sub CmdSave_Click()

Dim dt As String, sex As String, Qry As String

'VALIDATIONS
If TxtCode = "" Or TxtSurname = "" Or TxtFirst = "" Or TxtLast
= "" Or _
TxtAddress = "" Or TxtCity = "" Or TxtFee = "" Then
MsgBox "Enter all compulsory information.",
vbInformation, "Member Entry"
Exit Sub
End If
dt = CmbDay.Text & "/" & CmbMonth.Text & "/" &
CmbYear.Text
If OptMale.Value = True Then
sex = "M"
Else
sex = "F"
End If

'ADD RECORD
If cmd = "Add" Then

Qry = "insert into Mbr_Mast values ('" & TxtCode & "','" &
TxtSurname & "','" & _
TxtFirst & "','" & TxtLast & "','" & dt & "','" & TxtAddress &
"','" & _
TxtCity & "','" & CmbClass.Text & "','" &
CmbClassYear.Text & "','" & _
TxtContact & "','" & sex & "'," & TxtFee & ",0)"

conn.Execute Qry

Call CmbClassYear_Click 'TO RETRIVE UPDATED


DATA
Call CmdExit_Click 'TO RESET CONTROLS

MsgBox "Record added successfully.", vbInformation,


"Member Entry"

ElseIf cmd = "Edit" Then 'EDIT RECORD

Qry = "update Mbr_Mast set [surname]='" & TxtSurname &


"', [member]='" & _
TxtFirst & "', [father]='" & TxtLast & "', [Join_Dt]='" & dt &
"', [Address]='" & _
TxtAddress & "',[City]='" & TxtCity & "', [Cnt_No]='" & _
TxtContact & "',[Gender]='" & sex & "',[Fee]=" & TxtFee
& " where [Code]='" & _
TxtCode & "'" & " and [Crs]='" & Class & "' and [Yer]='" &
Yer & "'"

MsgBox Qry

conn.Execute Qry

Call CmdExit_Click 'TO RESET CONTROLS

End If

End Sub

Private Sub CmdTransfer_Click()


Unload Me
FrmTransfer.Show vbModal
End Sub

Private Sub Form_Load()


Dim i As Integer

'DAY COMBO
For i = 1 To 31
CmbDay.AddItem i
Next
'MONTH COMBO
For i = 1 To 12
CmbMonth.AddItem i
Next
'YEAR COMBO
For i = 1950 To 2050
CmbYear.AddItem i
Next

CmbClass.Text = Class
Me.MsfgSearch.FormatString = "No. |Code |Name
|Join Date |City "&_
"|Contect No. |Gender| Fine"

End Sub

Private Sub Form_Resize()

If Me.Width > 6630 Then


ShapLabel.Width = Me.ScaleWidth
LblLabel.Left = ShapLabel.Width / 2 - LblLabel.Width / 2
End If

End Sub

Private Sub Form_Unload(Cancel As Integer)


rs_mbr.Close

If Forms.Count = 2 Then
MDIFrm.Pct1.Visible = True
End If
End Sub

Private Sub MsfgSearch_Click()


rs_mbr.MoveFirst
rs_mbr.Find "Code = '" &
MsfgSearch.TextMatrix(MsfgSearch.Row, 1) & "'"

Call memberData(Me, rs_mbr) 'fill controls


End Sub

Private Sub MsfgSearch_RowColChange()


rs_mbr.MoveFirst
rs_mbr.Find "Code = '" &
MsfgSearch.TextMatrix(MsfgSearch.Row, 1) & "'"

Call memberData(Me, rs_mbr) 'fill controls


End Sub
Private Sub TxtAddress_GotFocus()
Call Book.selectTxt(TxtAddress)
End Sub

Private Sub TxtAddress_KeyPress(KeyAscii As Integer)


If KeyAscii = 39 Then
KeyAscii = 0
Exit Sub
End If
KeyAscii = Book.upper(KeyAscii)
End Sub

Private Sub TxtCity_GotFocus()


Call Book.selectTxt(TxtCity)
End Sub

Private Sub TxtCity_KeyPress(KeyAscii As Integer)


KeyAscii = alpha(KeyAscii)
End Sub

Private Sub TxtCode_GotFocus()


Call Book.selectTxt(TxtCode)
End Sub

Private Sub TxtCode_KeyPress(KeyAscii As Integer)


If KeyAscii < Asc("0") Or KeyAscii > Asc("9") Then
KeyAscii = 0
End If
End Sub

Private Sub TxtContact_GotFocus()


Call Book.selectTxt(TxtContact)
End Sub

Private Sub TxtContact_KeyPress(KeyAscii As Integer)


If KeyAscii = 8 Then
KeyAscii = 8
ElseIf (KeyAscii < Asc("0") Or KeyAscii > Asc("9")) And
KeyAscii <> Asc("-") Then
KeyAscii = 0
End If
End Sub

Private Sub TxtFee_GotFocus()


Call Book.selectTxt(TxtFee)
End Sub

Private Sub TxtFee_KeyPress(KeyAscii As Integer)


If KeyAscii = 8 Then
KeyAscii = 8
ElseIf KeyAscii < Asc("0") Or KeyAscii > Asc("9") Then
KeyAscii = 0
End If
End Sub

Private Sub TxtFirst_GotFocus()


Call Book.selectTxt(TxtFirst)
End Sub

Private Sub TxtFirst_KeyPress(KeyAscii As Integer)


KeyAscii = alpha(KeyAscii)
End Sub

Private Sub TxtLast_GotFocus()


Call Book.selectTxt(TxtLast)
End Sub

Private Sub TxtLast_KeyPress(KeyAscii As Integer)


KeyAscii = alpha(KeyAscii)
End Sub

Private Sub TxtSearch_Change()


Set rs_temp = New Recordset

rs_temp.Open "select * from Mbr_Mast where [Crs]='" &


CmbClass.Text & "' and [Yer]='" & CmbClassYear.Text & "'
and " & CmbSearch.Text & " like('" & TxtSearch & "%') order
by " & CmbSearch, conn, adOpenStatic, adLockReadOnly
If rs_temp.RecordCount = 0 Then
MsfgSearch.Enabled = False
Else
MsfgSearch.Enabled = True
End If

Call fillMbrGrid1(Me, rs_temp) 'fill grid


End Sub

Private Sub TxtSearch_GotFocus()


TxtSearch.Locked = False
End Sub

Private Sub TxtSearch_KeyPress(KeyAscii As Integer)


If KeyAscii = 39 Then
KeyAscii = 0
End If
KeyAscii = upper(KeyAscii)
End Sub

Private Sub TxtSurname_GotFocus()


Call Book.selectTxt(TxtSurname)
End Sub

Private Sub TxtSurname_KeyPress(KeyAscii As Integer)


KeyAscii = Member.alpha(KeyAscii)
End Sub

'================================================
===
Private Sub fillMbrGrid1(Frm As Form, rs As Recordset)
Dim r As Integer
Frm.MsfgSearch.Cols = 8
Frm.MsfgSearch.Rows = rs.RecordCount + 1

If rs.RecordCount > 0 Then


rs.MoveFirst
For r = 1 To rs.RecordCount
Frm.MsfgSearch.TextMatrix(r, 0) = r
Frm.MsfgSearch.TextMatrix(r, 0) = r
Frm.MsfgSearch.TextMatrix(r, 1) = rs.Fields(0)
Frm.MsfgSearch.TextMatrix(r, 2) = rs.Fields(1) & " " &
rs.Fields(2) & " " & rs.Fields(3)
Frm.MsfgSearch.TextMatrix(r, 3) =
Format(rs.Fields(4), "dd-mm-yyyy")
Frm.MsfgSearch.TextMatrix(r, 4) = rs.Fields(6)
Frm.MsfgSearch.TextMatrix(r, 5) = rs.Fields(9)
Frm.MsfgSearch.TextMatrix(r, 6) = rs.Fields(10)
Frm.MsfgSearch.TextMatrix(r, 7) = rs.Fields(12)
rs.MoveNext
Next
End If
End Sub

FORM – 9 : MEMBER TRANSFER


(FrmTransfer)
FORM – 9 : MEMBER TRANSFER
(FrmTransfer)
Option Explicit

Dim rs As New ADODB.Recordset


Dim rs1 As New ADODB.Recordset

Dim i As Integer, cnt As Integer


Dim Qry As String

Private Sub CmbClassFrom_Click()


Call fillYear(CmbClassFrom, CmbClassYearFrom)
CmbClassYearFrom.Text = CmbClassYearFrom.List(0)
End Sub

Private Sub CmbClassTo_Click()


Call fillYear(CmbClassTo, CmbClassYearTo)
CmbClassYearTo.Text = CmbClassYearTo.List(0)
End Sub

Private Sub CmbClassYearFrom_Click()

Set rs = New Recordset


rs.Open "SELECT * FROM Mbr_Mast WHERE [Crs]='" &
CmbClassFrom & _
"' AND [Yer]='" & CmbClassYearFrom & "'", conn,
adOpenStatic, adLockReadOnly

LstFrom.Clear
If rs.RecordCount > 0 Then

Do While Not rs.EOF


LstFrom.AddItem rs.Fields(0) & " " & _
rs.Fields(1) & " " & rs.Fields(2) & " " & rs.Fields(3)

rs.MoveNext
Loop
End If
End Sub

Private Sub CmbClassYearTo_Click()


Set rs1 = New Recordset
rs1.Open "SELECT * FROM Mbr_Mast WHERE [Crs]='" &
CmbClassTo.Text & _
"' AND [Yer]='" & CmbClassYearTo.Text & "' ORDER BY
Code", conn, adOpenStatic, adLockReadOnly

LstTo.Clear
If rs1.RecordCount > 0 Then

Do While Not rs1.EOF


LstTo.AddItem rs1.Fields(0) & " " & _
rs1.Fields(1) & " " & rs1.Fields(2) & " " &
rs1.Fields(3)

rs1.MoveNext
Loop

End If
End Sub

Private Sub CmdCancel_Click()


Unload Me
FrmMember.Show
End Sub

Private Sub CmdTransfer_Click()


'WHEN TRANSFER TO SAME CLASS & YEAR
If CmbClassFrom.Text = CmbClassTo.Text And
CmbClassYearFrom.Text = CmbClassYearTo.Text
Then

MsgBox "Member can not transfer to same class and


year", vbInformation, "Member Transfer"
Exit Sub
End If
If rs1.RecordCount = 0 Then
Qry = "UPDATE Mbr_Mast SET [Crs]='" &
CmbClassTo.Text & _
"',[Yer]='" & CmbClassYearTo.Text & "' WHERE [Crs]='"
&_
CmbClassFrom.Text & "' AND [Yer]='" &
CmbClassYearFrom.Text & "'"

conn.Execute Qry

MsgBox "Member transmitted successfully.",


vbInformation, "Member Transfer"

LstFrom.Clear
Call CmbClassYearTo_Click 'TO RETRIVE UPDATED
DATA
Else
MsgBox "Destination Class is not empty.", vbInformation,
"Member Transfer"
End If
End Sub

Private Sub Form_Load()

CmbClassFrom.Text = CmbClassFrom.List(0)
CmbClassTo.Text = CmbClassTo.List(0)

End Sub

'================================================
===
'FILL YEAR COMBO BOX
Public Sub fillYear(c As Control, y As Control)

y.Clear
If c.Text = "BBA" Or c.Text = "BCOM" Then

y.AddItem "FY"
y.AddItem "SY"
y.AddItem "TY"

ElseIf c.Text = "PGDCA" Or c.Text = "DCS" Then


For i = 1 To 2
y.AddItem "SEM" & i
Next
Else
For i = 1 To 6
y.AddItem "SEM" & i
Next
End If

End Sub

FORM – 10 : BOOK OPERATIONS


(FrmBkEntry)
FORM – 11 : ISSUE BOOK/CD (FrmBookIsu)
FORM – 12 : SUBMIT BOOK/CD (FrmBookIsu)
FORM – 13 : ISSUE DETAIL (FrmIsuDtl)
FORM – 14 : MEMBER & ISSUE REPORT
CREATION (FrmRpt)
FORM – 15 : ABOUT APPLICATION
(FrmAbout)

You might also like