Bank Management System in VB 6.0 using MS Access Database

 In this post, you will create an application in visual basic 6.0 with Microsoft access database as back-end to manage customer transactions and bank employee details. This project is called bank management system in vb 6.0 using ms access. Check other projects in vb 6.0.

Library Management System Project in VB 6.0 with MS Access

Student Record Management System Project in VB 6.0 with MS Access

Employee Record Management System Project in VB 6.0 with MS Access

The bank management system in vb 6.0 using ms access. must do the following tasks.

  1. INSERT, DELETE, UPDATE records of Employees and Customers.
  2. Keep track of customer transactions. Customer is allowed to withdraw and deposit money, not exceeding balance in account.
  3. Bank employees only work for the branch ith unique code.
  4. Customer and Bank employee can log into there account with userid and password.

The system will be developed in following ways

  1. Develop System Design
  2. Data Model [ E-R Diagram] 
  3. User Interface in VB 6.0
  4. Code the different Modules
  5. Verify the Output

SYSTEM MODEL

System Diagram - bank management system in vb 6.0 using ms access.
System Diagram -bank management system in vb 6.0 using ms access.

DATA MODEL

E-R Diagram

ER Diagram - System Diagram -bank management system in vb 6.0 using ms access.
ER Diagram – System Diagram -bank management system in vb 6.0 using ms access.

Tables

Using the E-R Diagram we can create a relational model of the database. It means we can create tables with the database. To create a new database go to the Microsoft Access Database and create a new blank database. If you have MS Access 2007 or Higher save the database with (.mdb) extension. Otherwise Visual Basic 6 may not recognize the database file.

Create three four tables with in the database with appropriate data-types given in the following figures.

Branch Table - Bank Management System
Branch Table – Bank Management System

 

Customer Table - Bank Management System
Customer Table – Bank Management System

 

Transaction Table - Bank Management System
Transaction Table – Bank Management System
Employee Table - Bank Management System
Employee Table – Bank Management System

 

MODULES AND FORMS

The modules used in this application are given below

(A) frmBankManagement

(B) frmLogin

(C) frmMENU [MDI Form]

Advertisements


(D) frmBranch

(E) frmCustomer

(F) frmEmployee

(G) frmTransaction

(H) Module1. bas

Components of frmBankManagement

FORM -bank management system in vb 6.0 using ms access.
FORM -bank management system in vb 6.0 using ms access.

Labels:

Name : lblBankManagement

Caption : Bank Management System

Buttons:

Name : cmdLogin

Caption : LOGIN

Code for frmBankMangement

Private Sub cmdLogin_Click()

    Unload Me
    frmLogin.Show

End Sub

Components of frmLogin

Form Login - Bank Management System
Form Login – Bank Management System

Labels

Name : lblUserID

Caption : UserID:

Name : lblPassword

Caption : Password:

Text-boxes

Name : txtUserID

Text : ‘leave blank’

Name : txtPassword

Text : Password

Buttons

Name : cmdLogin

Caption : Login

Name : cmdCancel

Caption : Cancel

Code for frmLogin

Option Explicit

Public LoginSucceeded As Boolean

Private Sub cmdCancel_Click()

    'set the global var to false 'to denote a failed login

    LoginSucceeded = False
    Me.Hide
End Sub

Private Sub cmdLogin_Click()

    rs.CursorLocation = adUseClient rec.CursorLocation
    = adUseClient rec.Open "SELECT * FROM Employee", con,
    adOpenDynamic, adLockPessimistic rs.Open
    "SELECT * FROM Customer", con, adOpenDynamic, adLockOptimistic

    'check the username

    While Not rs.EOF
    If txtUserID = rs!AccountNo And txtPassword = rs!Password Then
        frmMENU.Show
        LoginSucceeded = True
        con.Close MsgBox ("Connection Closed")
        Exit Sub
        Unload Me
    ElseIf
        Val(txtUserID) = rec!EID And txtPassword
        = rec!Password Then

        frmMENU.Show LoginSucceeded = True
        con.Close
        MsgBox ("Connection Closed")
        Exit Sub
        Unload Me
    ElseIf
        Val(txtUserID) <> rs!AccountNo Then

        rs.MoveNext ElseIf Val(txtUserID) <>
        rec!EID Then rec.MoveNext

    Else
        MsgBox "Invalid Password, try again!", ,
        "Login" txtPassword.SetFocus
        SendKeys "{Home}+{End}"

    Exit Sub
    End If
    Wend
    rs.Close
    rec.Close
End Sub

Private Sub Form_Load()
    Call loadcon
    MsgBox ("Connected")
End Sub

Components for frmBranch

Form Bank Branch -bank management system in vb 6.0 using ms access.
Form Bank Branch – Bank Management System

Labels

Name : lblBID

Caption : BRANCH ID:

Name : lblBcode,/p>

Caption :BRANCH CODE

Name : lblLocation

Caption : LOCATION

Name : lblTotEmp

Caption : TOTAL EMPLOYEE

Text-boxes

Name: txtBID

Text : ‘leave blank’

Name : txtBcode

Text : ‘leave blank’

Name : txtLocation

Text : ‘leave blank’

Name : txtTotEmp

Text : ‘leave blank’

Buttons

Name : cmdAdd

Caption : &ADD

Name : cmdDel

Caption : &DELETE

Name : cmdUpdate

Caption: &UPDATE

Name : cmdDisplay

Caption : &DISPLAY

Name : cmdClr

Caption : &CLEAR

Name : cmdExit

Caption : &EXIT

DataGrids

Name : DataGrid1

Code for frmBranch

Private Sub cmdAdd_Click()

Dim total As Double


    rs.Open "SELECT Count(EID) FROM Employee",
    con, adOpenDynamic, adLockPessimistic

    total = rs.Fields(0).Value

    con.Execute "INSERT INTO
    Branch(BID, Bcode, Location , TotalEmployees )
    VALUES ("
& txtBID & ",'" & txtBcode &
     "','" & txtLocation & "', " & total & ")"

    MsgBox ("Record Added")

End Sub

Private Sub cmdClr_Click()

    txtBID = " "
    txtBcode = " "
    txtLocation = " "
    txtTotEmp = " "

End Sub

Private Sub cmdDel_Click()
    con.Execute "DELETE * FROM Branch
    WHERE BID = "
& txtBID & ""
    MsgBox ("Record Deleted")

End Sub

Private Sub cmdDisplay_Click()

    rs.CursorLocation = adUseClient

    rs.Open "SELECT * FROM Branch",
    con, adOpenDynamic, adLockPessimistic

    Set DataGrid1.DataSource = rs

End Sub

Private Sub cmdExit_Click()

    Unload Me
    con.Close

End Sub

Private Sub cmdUpdate_Click()
Dim total As Double


    rs.Open "SELECT Count(EID) FROM
    Employee WHERE BID = "
&
    txtBID & " ", con,
    adOpenDynamic, adLockPessimistic

    total = rs.Fields(0).Value

    con.Execute "UPDATE Branch SET Bcode
    = '"
& txtBcode & "',Location
    = '"
& txtLocation & " ',
    TotalEmployees = "
& total & "
    WHERE BID = "
& txtBID & " "

    MsgBox ("Record Updated ")

End Sub

Private Sub Form_Load()

    Call loadcon

End Sub

Components of frmCustomer

Form Customer Details - bank management system in vb 6.0 using ms access.
Form Customer Details – Bank Management System

Labels

Name :lblAno

Caption : ACCOUNT NO:

Name :lblAname

Caption : ACCOUNT NAME

Name : lblAddress

Caption : BALANCE

Name : lblBrankID

Caption : BRANCH ID:

Text-Boxes

Name : txtAno

Text : ‘leave blank’

Name : txtAname

Text ; ‘leave blank’

Name : txtAddress

Text : ‘leave blank'</p

Name : txtBalance

Text : ‘leave blank’

Name : txtBID

Text : ‘leave blank’

Buttons

Name : cmdAdd

Caption : &ADD

Name : cmdDel

Caption : &DELETE

Name : cmdClr

Caption : &CLEAR

Name : cmdExit

Caption : &EXIT

Name : cmdUPDATE

Caption : &UPDATE

Name : cmdDisplay

Caption : &DISPLAY

Code for frmCustomer

Private Sub cmdAdd_Click()

    con.Execute "INSERT INTO Customer ( AccountNo, AccountName, Address, Balance, BID )
    VALUES("
&amp; txtAno &amp; ",' " &amp; txtAname &amp;
    " ',' " &amp; txtAddress &amp; " '," &amp;
    txtBalance &amp; ", " &amp; txtBID &amp; ")"
    txtAno = "" txtAname = "" txtAddress = ""
    txtBalance = "" txtBID = ""

    MsgBox ("Record Added")

End Sub

Private Sub cmdClr_Click()

    txtAno = ""
    txtAname = ""
    txtAddress = ""
    txtBalance = ""
    txtBID = ""

End Sub

Private Sub cmdDel_Click()

    con.Execute "DELETE * FROM Customer
    WHERE AccountNo = "
&amp; txtAno &amp; ""

    MsgBox ("Record Deleted")

End Sub

Private Sub cmdDisplay_Click()

    rs.Open "SELECT * FROM Customer",
    con, adOpenDynamic, adLockPessimistic
    Set DataGrid1.DataSource = rs

End Sub

Private Sub cmdExit_Click()

    Unload Me
    con.Close

End Sub

Private Sub cmdUpdate_Click()

    con.Execute "UPDATE Customer
    SET AccountName = '"
&amp; txtAname &amp; " ',
    Address = ' "
&amp; txtAddress &amp; " ',
    Balance = "
&amp; txtBalance &amp; "
    WHERE AccountNo = "
&amp; txtAno &amp; "" txtAno = ""

    MsgBox ("Record Updated!")

End Sub


Private Sub Form_Load()
    Call loadcon
    MsgBox ("connected")
End Sub

 

Components of frmEmployees

Form Employee Details - Bank Management System
Form Employee Details – Bank Management System

Labels

Name : lblEID

Caption : EID

Name : lblEname

Caption : EMPLOYEE NAME

Name : lblDesig

Caption : DESIGNATION

Name : lblSalary

Caption : SALARY

Name : lblWeekoff

Caption :WEEKOFF

Name : lblBranchID

Caption : BRANCH ID

Text-boxes

Name : txtEID

Text : ‘leave blank’

Name : txtEname

Text : ‘leave blank’

Name : txtDesig

Text ; ‘leave blank’

Name ; txtSalary

Text : ‘leave blank’

Name : txtWeekoff

Text : ‘leave blank’

Name : txtBID

Text : ‘leave blank’

Buttons

Name : cmdAdd

Caption : &ADD

Name : cmdDel

Caption : &DELETE

Name : cmdUpdate

Caption : &UPDATE

Name : cmdDisplay

Caption : &DISPLAY

Name : cmdClr

Caption : &CLEAR

Name : cmdExit

Caption : &EXIT

DataGrid

Name : DataGrid 1

Code for frmEmployee

Private Sub cmdAdd_Click()
    con.Execute "INSERT INTO
    Employee (EID, Ename, Designation, Salary, Weekoff, BID)
    VALUES (" &amp; txtEID &amp; ",'" &amp;
    txtEname &amp; "','" &amp;
    txtDesig &amp; "', " &amp;
    txtSalary &amp; ", '" &amp;
    txtWeekoff &amp; "', " &amp;
    txtBID &amp; ")"
    MsgBox ("Record Added")
    txtEID = "" txtEname = "" txtDesig
    = "" txtSalary = "" txtWeekoff = "" txtBID = ""

End Sub

Private Sub cmdClr_Click()

    txtEID = ""
    txtEname = ""
    txtDesig = ""
    txtSalary = ""
    txtWeekoff = ""
    txtBID = ""

End Sub

Private Sub cmdDel_Click()

    con.Execute "DELETE * FROM
    Employee WHERE EID = " &amp;
    txtEID &amp; ""

    MsgBox ("Record Deleted ")

    txtEID = ""

End Sub

Private Sub cmdDisplay_Click()

    rs.Open "SELECT * FROM Employee",
    con, adOpenDynamic, adLockPessimistic
    Set DataGrid1.DataSource = rs

End Sub

Private Sub cmdExit_Click()

    Unload Me
    con.Close

End Sub

Private Sub cmdUpdate_Click()

    con.Execute "UPDATE Employee
    SET Ename = '" &amp;
    txtEname &amp; "',Designation = '" &amp;
    txtDesig &amp; "',Salary = " &amp;
    txtSalary &amp; ",Weekoff = ' " &amp;
    txtWeekoff &amp; " ', BID =  " &amp;
    txtBID &amp; " WHERE EID = " &amp;
    txtBID &amp; " "

    MsgBox ("Record Updated")

End Sub

Private Sub Form_Load()

    loadcon

End Sub
</cc]

<h2 style="text-align: left;">Components of frmTransaction</h2>
[caption id="attachment_2588" align="aligncenter" width="550"]<img class="wp-image-2588" src="http://notesformsc.org/wp-content/uploads/2016/12/frmTransactBank.png" alt="Form Transaction - Bank Management System" width="550" height="344" /> Form Transaction - Bank Management System[/caption]
<p style="text-align: left;"><strong>Labels</strong></p>
Name : lblTID
Caption : TRANSACTION ID

Name : lblBID
Caption : BRANCH ID

Name :lblAno
Caption : ACCOUNT NO

Name : lblWDraw
Caption : WITHDRAW

Name : lblDEPOSIT
Caption : lblDeposit

Name : lblDate
Caption : DATE
<p style="text-align: left;"><strong>Text-boxes</strong></p>
Name : txtTID

Text : 'leave blank'

Name ; txtBID

Text : 'leave blank'

Name : txtAno

Text : 'leave blank'

Name : txtWDraw

Text : 'leave blank'

Name : txtDeposit

Text : 'leave blank'

Name : txtDate

Text : 'leave blank'
<p style="text-align: left;"><strong>Buttons</strong></p>
Name : cmdAdd

Caption : &amp;ADD

Name : cmdDel

Caption : &amp;DELETE

Name : cmdUpdate

Caption : &amp;UPDATE

Name : cmdDisplay

Caption : &amp;DISPLAY
<div>Name : cmdClr</div>
Caption : &amp;CLEAR

Name : cmdExit

Caption : &amp;EXIT
<p style="text-align: left;"><strong>Data Grids</strong></p>
Name : Data Grid 1
<h2>Code for frmTransaction</h2>
[cc lang="vb" tab_size="4"]

Private Sub cmdAdd_Click()

    con.Execute "INSERT INTO
    Trans(TID, BID, AccountNo, Withdraw, Deposit, TransactionDate )
    VALUES (" &amp; txtTID &amp; "," &amp;
    txtBID &amp; ", " &amp;
    txtAno &amp; "," &amp;
    txtWDraw &amp; ", " &amp;
    txtDeposit &amp; ", ' " &amp;
    txtDate &amp; "' )"
    txtTID = "" txtBID = "" txtAno
    = "" txtWDraw = "" txtDeposit
    = "" txtDate = ""

    MsgBox ("Record Added")

End Sub

Private Sub cmdClr_Click()

    txtTID = ""
    txtBID = ""
    txtAno = ""
    txtWDraw = ""
    txtDeposit = ""
    txtDate = ""

End Sub

Private Sub cmdDel_Click()

    con.Execute "DELETE * FROM
    Trans WHERE TID = " &amp;
    txtTID &amp; ""

    MsgBox ("Record Deleted")

End Sub

Private Sub cmdDisplay_Click()

    rs.Open "SELECT * FROM Trans ", con,
    adOpenDynamic, adLockPessimistic
    Set DataGrid1.DataSource = rs

End Sub

Private Sub cmdExit_Click()
    Unload Me
    con.Close
End Sub

Private Sub cmdUpdate_Click()

    con.Execute "UPDATE Trans SET
    BID = " &amp; txtBID &amp; " ,
    AccountNo = " &amp; txtAno &amp; " ,
    Withdraw = " &amp; txtWDraw &amp; ",
    Deposit =  " &amp; txtDeposit &amp; "  
    WHERE TID = " &amp; txtTID &amp; ""
    txtTID = "" txtBID = "" txtAno
    = "" txtWDraw = "" txtDeposit = "" txtDate = ""

    MsgBox ("Record Updated")

End Sub

Private Sub Form_Load()

    Call loadcon
    MsgBox ("connected")

End Sub

frmMENU [ MDI Form ]

The MDI form is that form which has MENU and when you click on any one of the menu item, it opens up another MDI Child form.

We will set MDI Child property for following forms

  1. frmBranch
  2. frmCustomer
  3. frmEmployee
  4. frmTransaction 
Go to the property of each form and set the MDI Child to ‘True’.
Set MDI Child to True
Set MDI Child to True
Under Project 1 , [Right Click] the Forms > [Click] Add > [Click] MDI Form.
Create MDI Form
Create MDI Form

Configure Menu using the Menu Editor in MDI Form and write appropriate code for the form.

Form Menu - Bank Management System
Form Menu – Bank Management System

Code for frmMENU

Private Sub branch_Click(Index As Integer)
    frmBranch.Show
End Sub

Private Sub customer_Click(Index As Integer)
   frmCustomer.Show
End Sub

Private Sub employee_Click(Index As Integer)
    frmEmployee.Show
End Sub

Private Sub exit_Click(Index As Integer)
    Unload Me
    Unload frmBankManagement
    Unload frmLogin
    Unload frmCustomer
    Unload frmEmployee
End Sub


Private Sub transaction_Click(Index As Integer)

    frmTransaction.Show

End Sub

Code for Module1.Bas

Most of the forms in the application need to connect to the database, so you may have to write code for connectivity with Microsoft Access Database repeatedly in each form.

Instead of writing the code for connectivity in each form, we write it once in a Module and call the function from the form. In this way we save time to write the same code many times.

Here is the code for Module1.bas

Note; To know more about creating a new Module go to one of the previous Visual Basic 6 posts.

 

Public con As ADODB.Connection
Public rs As ADODB.Recordset
Public constr As String
Public Sub loadcon() constr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:UsersGirishDocumentsStudentDB.mdb;Persist Security Info=False"
con.Open constr
End Sub
Advertisements