Professional Documents
Culture Documents
Banking System-Visyal Basic 6.0 Project
Banking System-Visyal Basic 6.0 Project
Banking System-Visyal Basic 6.0 Project
HOMESCREEN WINDOW
The Visual Basic Enterprise edition: - it is the most advanced edition and is aimed at programmers who build distributed application in a team environment. It includes all the features the professional edition, plus tools such as visual SourceSafe and the automation and component manager.
Menu Bar
Displays the commands you use to work with Visual Basic. Besides the standard File, Edit, View, Window, and Help menus, menus are provided to access functions specific to programming such as Project, Format, or Debug.
Context Menus
Contain shortcuts to frequently performed actions. To open a context menu, click the right mouse button on the object you're using. The specific list of shortcuts available from context menus depends on the part of the environment where you click the right mouse button. For example, the context menu displayed when you right click on the Toolbox lets you display the Components dialog box, hide the Toolbox, dock or undock the Toolbox, or add a custom tab to the Toolbox.
Toolbars
Provide quick access to commonly used commands in the programming environment. You click a button on the toolbar once to carry out the action represented by that button. By default, the Standard toolbar is displayed when you start Visual Basic. Additional toolbars for editing, form design, and debugging can be toggled on or off from the Toolbars command on the View menu. Toolbars can be docked beneath the menu bar or can "float" if you select the vertical bar on the left edge and drag it away from the menu bar.
7
Toolbox
Provides a set of tools that you use at design time to place controls on a form. In addition to the default toolbox layout, you can create your own custom layouts by selecting Add Tab from the context menu and adding controls to the resulting tab.
Properties Window
Lists the property settings for the selected form or control. A property is a characteristic of an object, such as size, caption, or color.
Object Browser
Lists objects available for use in your project and gives you a quick way to navigate through your code. You can use the Object Browser to explore objects in Visual Basic and other applications, see what methods and properties are available for those objects, and paste code procedures into your application. By using the Object Browser to view procedures, see "Finding out about Objects" in "Programming with Objects." For details on using add-ins to extend the Visual Basic programming environment, see "Using Wizards and Add-ins" in "Managing Projects."
Form Designer
Serves as a window that you customize to design the interface of your application. You add controls, graphics, and pictures to a form to create the look you want. Each form in your application has its own form designer window.
PictureBox
Displays graphical images (either decorative or active), as a container that receives output from graphics methods, or as a container for other controls.
Label
Allows you to have text that you don't want the user to change, such as a caption under a graphic.
TextBox
Holds text that the user can either enter or change.
Frame
Allows you to create a graphical or functional grouping for controls. To group controls, draw the Frame first, and then draw controls inside the frame.
CommandButton
Creates a button the user can choose to carry out a command.
10
CheckBox
Creates a box that the user can easily choose to indicate if something is true or false, or to display multiple choices when the user can choose more than one.
OptionButton
Allows you to display multiple choices from which the user can choose only one.
ComboBox
Allows you to draw a combination list box and text box. The user can either choose an item from the list or enter a value in the text box.
ListBox
Used to display a list of items from which the user can choose one. The list can be scrolled if it has more items than can be displayed at one time.
11
Timer
Generates timer events at set intervals. This control is invisible at run time.
DriveListBox
Displays valid disk drives.
FileListBox
Displays a list of files.
Shape
Allows you to draw a variety of shapes on your form at design time. You can choose a rectangle, rounded rectangle, square, rounded square, oval, or circle. Line Used to draw a variety of line styles on your form at design time.
Image
Displays a graphical image from a bitmap, icon, or metafile on your form. Images displayed in an Image control can only be decorative and use fewer resources than a PictureBox.
Data
Provides access to data in databases through bound controls on your form.
12
OLE
Allows you to link and embed objects from other applications in your Visual Basic application
Variables
Were now ready to attach code to our application. As objects are added to the form, Visual Basic automatically builds a framework of all event procedures. We simply add code to the event procedures we want our application to respond to. But before we do this, we need to discuss variables. Variables are used by Visual Basic to hold information needed by your application. Rules used in naming variables: No more than 40 characters They may include letters, numbers, and underscore (_) The first character must be a letter You cannot use a reserved word (word needed by Visual Basic)
13
Variable Declaration
There are three ways for a variable to be typed (declared): 1. Default 2. Implicit 3. Explicit If variables are not implicitly or explicitly typed, they are assigned the variant type by default. The variant data type is a special type used by Visual Basic that can contain numeric, string, or date data.
14
15
Tables to store your data. Queries to find and retrieve just the data you want. Forms to view, add, and update data in tables. Reports to analyze or print data in a specific layout. Data access pages to view, update, or analyze the database's data from the Internet or an intranet.
QUERIES
To find and retrieve just the data that meets conditions that you specify, including data from multiple tables, create a query. A query can also update or delete multiple records at the same time, and perform predefined or custom calculations on your data.
FORMS
To easily view, enter, and change data directly in a table, create a form. When you open a form, Microsoft Access retrieves the data from one or more tables, and displays it on the screen with the layout you choose in the Form Wizard, or with the layout that you created on your own in Design view (Design view: A window that shows the design of these database objects: tables, queries, forms, reports, macros, and data access
16
pages. In Design view, you can create new database objects and modify the design of existing ones.). A table displays many records at the same time, but you might have to scroll to see all of the data in a single record. Also, when viewing a table, you can't update data from more than one table at the same time. A form focuses on one record at a time, and it can display fields from more than one table. It can also display pictures and other objects. A form can contain a button that prints, opens other objects, or otherwise automates tasks
REPORTS
To analyze your data or present it a certain way in print, create a report. For example, you might print one report that groups data and calculates totals, and another report with different data formatted for printing mailing labels Use a report to create mailing labels. Use a report to show totals in a chart. Use a report to calculate totals
MACROS
A macro is a set of one or more actions (action: The basic building block of a macro; a self-contained instruction that can be combined with other actions to automate tasks. This is sometimes called a command in other macro languages.) that each perform a particular operation, such as opening a form or printing a report. Macros can help you to automate
17
common tasks. For example, you can run a macro that prints a report when a user clicks a command button.
MACRO GROUP
If you have numerous macros, grouping related macros in macro groups (macro group: A collection of related macros that are stored together under a single macro name. The collection is often referred to simply as a macro.) can help you to manage your database more easily. For example, the following macro group, named Buttons, is made up of three related macros: Employees, Products, and Reps. Each macro carries out the OpenForm action, and the Products macro also carries out the MoveSize action.
18
19
20
21
query = "select * from emp_detail where emp_names='" & emp_name.Text & "' and emp_ids=" & emp_id.Text & " " OpenRecordset If Not rs.EOF Then If UCase(rs.Fields("type")) = "TRUE" Then MsgBox "YOUR ACCOUNT HAS BEEN CLOSED", vbOKOnly + 64, "ALERT! Account Closed" CloseRecordset Disconnect emp_id.Text = "" emp_name.Text = "" Exit Sub Else CloseRecordset Disconnect emp_id.Text = "" Form1.Show End If Else MsgBox "INVALID Customer name or Account number. ", vbOKOnly, " ERROR! Check Customer & Account" emp_name.SetFocus SendKeys "{HOME}+{END}" emp_id.Text = "" CloseRecordset Disconnect Exit Sub End If End Sub Private Sub Command2_Click() MsgBox "THANKS YOU! LOGOUT SUCCESSFULLY", vbOKOnly, " LOGOUT MESSAGE."
22
End End Sub Private Sub Form_Load() dt.Caption = Format(Date, "dd-mmm-yyyy") dy.Caption = Format(Date, "dddd") X=0 Form1.BorderStyle = 0 TM.Caption = Time g(0) = RGB(0, 255, 0) g(1) = RGB(0, 0, 255) g(2) = RGB(255, 0, 0) g(3) = RGB(128, 255, 248) g(4) = RGB(255, 120, 242) g(5) = RGB(100, 255, 241) g(6) = RGB(200, 255, 240) g(7) = RGB(160, 255, 247) g(8) = RGB(111, 112, 240) g(9) = RGB(130, 140, 160) g(10) = RGB(190, 180, 170) End Sub Private Sub Timer1_Timer() Label3.ForeColor = g(l) l=l+1 If (l = 11) Then l=0 End If End Sub Private Sub Timer2_Timer() Timer2.Interval = 50 Label5.Left = Label5.Left - 50 If Label5.Left < -50 Then Label5.Left = Screen.Width End If
23
OpenRecordset If Not rs.EOF Then If UCase(rs.Fields("closed")) = "TRUE" Then MsgBox "YOUR ACCOUNT HAS BEEN CLOSED", vbOKOnly + 64, "ALERT! Account Closed" CloseRecordset Disconnect acnotext.Text = "" pastext.Text = "" Exit Sub Else mode = rs.Fields("account_type") chequefacility = rs.Fields("cheque_facility") CloseRecordset Disconnect pastext.Text = "" Form21.Show End If Else MsgBox "INVALID Customer name or Account number. ", vbOKOnly, " ERROR! Check Customer & Account" acnotext.SetFocus SendKeys "{HOME}+{END}" pastext.Text = "" CloseRecordset Disconnect Exit Sub End If End Sub Private Sub Form_Load() dt.Caption = Format(Date, "dd-mmm-yyyy") dy.Caption = Format(Date, "dddd") X=0
25
Form1.BorderStyle = 0 TM.Caption = Time picAccountBox.Move (ScaleWidth / 2) - (picAccountBox.Width / 2), (ScaleHeight / 2) - (picAccountBox.Height / 2) Picture2.Move (ScaleWidth / 2) - (Picture2.Width / 2) 'query = "select * from transact " 'OpenRecordset 'Do While Not rs.EOF g(0) = RGB(0, 255, 0) g(1) = RGB(0, 0, 255) g(2) = RGB(255, 0, 0) g(3) = RGB(128, 255, 248) g(4) = RGB(255, 120, 242) g(5) = RGB(100, 255, 241) g(6) = RGB(200, 255, 240) g(7) = RGB(160, 255, 247) g(8) = RGB(111, 112, 240) g(9) = RGB(130, 140, 160) g(10) = RGB(190, 180, 170) End Sub Private Sub fornewac_Click() Form2.Show (1) End Sub Private Sub Label8_Click() Form10.Show 1 End Sub Private Sub Label9_Click() Form17.Show 1 End Sub Private Sub QUIT_Click() Unload Me
26
Form20.Show End Sub Private Sub reopen_Click() Form14.Show 1 End Sub Private Sub Timer1_Timer() TM.Caption = Time End Sub Private Sub Timer2_Timer() Label6.ForeColor = g(l) l=l+1 If (l = 11) Then l=0 End If End Sub Private Sub Timer3_Timer() Timer3.Interval = 50 Label1.Left = Label1.Left - 50 If Label1.Left < -50 Then Label1.Left = Screen.Width End If End Sub
27
MSHFlexGrid1.Row = RowCount MSHFlexGrid1.Text = rs.Fields("acholder_name") MSHFlexGrid1.Col = 2 MSHFlexGrid1.Row = RowCount MSHFlexGrid1.Text = rs.Fields("address") rs.MoveNext Loop CloseRecordset Disconnect End Sub
29
Timer1.Interval = 500 s = "ACCOUNT OPENING SCREEN" Connect rs.Open "account_master", con, adOpenDynamic, adLockOptimistic, adCmdTable If Not rs.EOF Then rs.MoveLast a = rs.Fields(0) acno = a + 1 CloseRecordset Else acno = 1001 CloseRecordset End If jholdername.Visible = False jholderage.Visible = False joccupation.Visible = False jname.Visible = False jage.Visible = False joccup.Visible = False Shape18.Visible = False Shape19.Visible = False Shape20.Visible = False Disconnect End Sub Private Sub joint_Click() mode = "JOINT" jholdername.Visible = True jholderage.Visible = True joccupation.Visible = True jname.Visible = True jage.Visible = True joccup.Visible = True Shape18.Visible = True
31
Shape19.Visible = True Shape20.Visible = True End Sub Private Sub Label1_Click() Form17.Show 1 End Sub Private Sub no_Click() chefaci = "NO" End Sub Private Sub savings_Click() actype = "SAVINGS" End Sub Private Sub singal_Click() mode = "SINGLE" jholdername.Visible = False jholderage.Visible = False joccupation.Visible = False jname.Visible = False jage.Visible = False joccup.Visible = False Shape18.Visible = False Shape19.Visible = False Shape20.Visible = False End Sub Private Sub submit_Click() s = "ACCOUNT OPENING SCREEN" Timer1.Enabled = True checkfields If m = 1 Then m=0
32
Exit Sub End If opamt = Val(openingamount.Text) If actype = "SAVINGS" And chefaci = "YES" Then minbal = 1500 ElseIf actype = "SAVINGS" And chefaci = "NO" Then minbal = 1000 ElseIf actype = "CURRENT" And chefaci = "YES" Then minbal = 3000 Else minbal = 2000 End If If opamt < minbal Then rep = MsgBox("Error in opening balance amount" & vbCrLf & "Want to see the criteria ", vbYesNo + vbInformation, "Error...") If rep = vbNo Then openingamount.SetFocus SendKeys "{HOME}+{END}" Exit Sub Else MsgBox "Account Type" & Space(5) & "Cheque Facility" & Space(5) & "Minimum Balance" & Chr(13) & Chr(13) & " 1. SAVINGS" & Space(15) & "YES" & Space(20) & "1500" & Chr(13) & " 2. SAVINGS" & Space(15) & "NO" & Space(22) & "1000" & Chr(13) & " 3. CURRENT" & Space(15) & "YES" & Space(20) & "3000" & Chr(13) & " 4. CURRENT" & Space(15) & "NO" & Space(22) & "2000", vbOKOnly + vbInformation, "Minimum Balance" openingamount.SetFocus SendKeys "{HOME}+{END}" Exit Sub End If End If wnam = UCase(Text1.Text) wad = UCase(Text2.Text) wacc = Val(Text3.Text)
33
Connect sql = "select * from account_master where acholder_name='" & wnam & "' and address='" & wad & "' and account_no=" & wacc rs.Open sql, con, adOpenDynamic, adLockOptimistic, adCmdText If rs.EOF Then MsgBox "Error occured due to these reasons" & vbCrLf & " 1. Witness name is not correct" & vbCrLf & " 2. Witness address is wrong" & vbCrLf & " 3. Witness doesnot hold any account" & vbCrLf & "Please check these things", vbInformation, "Error Occured" Text1.SetFocus CloseRecordset Exit Sub Else CloseRecordset 'inserting records into account_master table rs.Open "account_master", con, adOpenDynamic, adLockOptimistic, adCmdTable rs.AddNew rs.Fields(0) = acno rs.Fields(1) = UCase(acnametext.Text) rs.Fields(3) = Val(acagetext.Text) If mode = "SINGLE" Then rs.Fields(4) = "" rs.Fields(5) = 0 rs.Fields(7) = "" Else rs.Fields(4) = UCase(jname.Text) rs.Fields(5) = Val(jage.Text) rs.Fields(7) = UCase(joccup.Text) End If rs.Fields(6) = UCase(acocctext.Text) rs.Fields(8) = UCase(acaddtext.Text) rs.Fields(9) = Val(acphtext.Text) rs.Fields(10) = chefaci
34
rs.Fields(11) = actype rs.Fields(12) = mode rs.Fields(13) = Date rs.Fields(14) = "FALSE" rs.Fields(15) = opamt rs.Update CloseRecordset 'inserting records into witness_details table rs.Open "witness_details", con, adOpenDynamic, adLockOptimistic, adCmdTable rs.AddNew rs.Fields(0) = acno rs.Fields(1) = UCase(Text1.Text) rs.Fields(2) = UCase(Text2.Text) rs.Fields(3) = Val(Text3.Text) rs.Update CloseRecordset End If 'inserting records into nominee_details table rs.Open "nominee_details", con, adOpenDynamic, adLockOptimistic, adCmdTable rs.AddNew rs.Fields(0) = acno rs.Fields(1) = UCase(Text4.Text) rs.Fields(2) = UCase(Text5.Text) rs.Fields(3) = UCase(Text6.Text) rs.Update CloseRecordset 'inserting records into current_details table rs.Open "current_details", con, adOpenDynamic, adLockOptimistic, adCmdTable rs.AddNew rs.Fields(0) = acno rs.Fields(1) = opamt rs.Fields(2) = Date
35
rs.Update CloseRecordset Disconnect resettextbox Form3.Show 1 End Sub Private Sub Timer1_Timer() i=i+1 lb1.Caption = lb1.Caption & Mid(s, i, 1) If lb1.Caption = "ACCOUNT OPENING SCREEN" Then Timer1.Enabled = False End If End Sub Private Sub yes_Click() chefaci = "YES" End Sub Private Sub resettextbox() acnametext.Text = "" jname.Text = "" acagetext.Text = "" jage.Text = "" acocctext.Text = "" joccup.Text = "" acaddtext.Text = "" acphtext.Text = "" yes.Value = False no.Value = False singal.Value = False joint.Value = False savings.Value = False current.Value = False openingamount.Text = ""
36
Text1.Text = "" Text2.Text = "" Text3.Text = "" Text4.Text = "" Text5.Text = "" Text6.Text = "" End Sub Private Sub checkfields() If acnametext.Text = "" Then MsgBox "Enter the account holder name", , "Caution" m=1 acnametext.SetFocus Exit Sub End If If IsNumeric(acnametext.Text) Then MsgBox "Numeric value is not allowed in this field", , "Caution" acnametext.SetFocus SendKeys "{home}+{end}" m=1 acnametext.SetFocus Exit Sub End If If acagetext.Text = "" Then MsgBox "Enter your age", , "Caution" m=1 acagetext.SetFocus Exit Sub ElseIf Val(acagetext.Text) < 18 Then MsgBox "Your age must be 18 years or more", , "Invalid age" m=1 Exit Sub ElseIf Len(acagetext.Text) > 2 Then
37
MsgBox "Enter a valid age that should be under 100 years", , "Invalid age" m=1 acagetext.SetFocus SendKeys "{home}+{end}" Exit Sub End If If Not IsNumeric(acagetext.Text) Then MsgBox "Only numeric value is allowed", , "Caution" m=1 acagetext.SetFocus Exit Sub End If If acocctext.Text = "" Then MsgBox "Give your occupation", , "Caution" acocctext.SetFocus m=1 Exit Sub ElseIf IsNumeric(acocctext.Text) Then MsgBox "Invalid entry", , "Caution" acocctext.SetFocus SendKeys "{home}+{end}" m=1 Exit Sub End If If acaddtext.Text = "" Then MsgBox "Address must be entered", , "Caution" acaddtext.SetFocus m=1 Exit Sub ElseIf IsNumeric(acaddtext.Text) Then MsgBox "Enter string not numeric", , "Caution" acaddtext.SetFocus SendKeys "{home}+{end}" m=1
38
Exit Sub End If If joint.Value = True Then If jname.Text = "" Then MsgBox "Enter the joint account holder name", , "Caution" jname.SetFocus m=1 Exit Sub ElseIf IsNumeric(jname.Text) Then MsgBox "Invalid entry not allowed", , "Error" jname.SetFocus SendKeys "{home}+{end}" m=1 Exit Sub ElseIf jage.Text = "" Then MsgBox "Enter the joint account holder age", , "Caution" jage.SetFocus m=1 Exit Sub ElseIf Not IsNumeric(jage.Text) Then MsgBox "Invalid entry not allowed", , "Error" jage.SetFocus SendKeys "{home}+{end}" m=1 Exit Sub ElseIf joccup.Text = "" Then MsgBox "Enter the joint account holder occupation", , "Caution" joccup.SetFocus m=1 Exit Sub ElseIf IsNumeric(jname.Text) Then MsgBox "Invalid entry not allowed", , "Error" joccup.SetFocus SendKeys "{home}+{end}" m=1
39
40
Disconnect Unload Me End If End Sub Private Sub cancel_Click() Unload Me End Sub Private Sub checkfields() If Text1.Text = "" Then MsgBox "Give your account number" Text1.SetFocus m=1 Exit Sub ElseIf Not IsNumeric(Text1.Text) Then MsgBox "enter only text" Text1.SetFocus SendKeys "{home}+{end}" m=1 Exit Sub End If If Text3.Text = "" Then MsgBox "Deposit amount to re-open your account" Text3.SetFocus m=1 Exit Sub ElseIf Not IsNumeric(Text3.Text) Then MsgBox "This type of entry is not allowed only currency" Text3.SetFocus SendKeys "{home}+{end}" m=1 Exit Sub ElseIf Val(Text3.Text) < 2000 Then MsgBox "Atleast 2000 opening balance"
42
43
44
45
47
Private Sub depbycheque_Click() Form13.Show 1 End Sub Private Sub depbycheque_MouseMove(Button As Integer, Shift As Integer, X As Single, y As Single) Shape13.Visible = False End Sub Private Sub deposit_Click() Form8.Show 1 End Sub Private Sub deposit_MouseMove(Button As Integer, Shift As Integer, X As Single, y As Single) Shape12.Visible = False End Sub Private Sub Form_Load() Connect query = "select * from account_master where account_no=" & Form1.acnumber OpenRecordset Label2.Caption = rs.Fields("acholder_name") CloseRecordset Disconnect g(0) = RGB(0, 255, 0) g(1) = RGB(0, 0, 255) g(2) = RGB(255, 0, 0) g(3) = RGB(128, 255, 248) g(4) = RGB(255, 120, 242) g(5) = RGB(100, 255, 241) g(6) = RGB(200, 255, 240) g(7) = RGB(160, 255, 247) g(8) = RGB(111, 112, 240)
48
g(9) = RGB(130, 140, 160) g(10) = RGB(190, 180, 170) End Sub Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, y As Single) If Shape8.Visible = False Then Shape8.Visible = True If Shape9.Visible = False Then Shape9.Visible = True If Shape10.Visible = False Then Shape10.Visible = True If Shape11.Visible = False Then Shape11.Visible = True If Shape12.Visible = False Then Shape12.Visible = True If Shape13.Visible = False Then Shape13.Visible = True If Shape15.Visible = False Then Shape15.Visible = True Connect query = "select * from current_details where account_no=" & Form1.acnumber OpenRecordset CloseRecordset Disconnect End Sub Private Sub Label4_Click() rep = MsgBox("Do you want to close your account", vbYesNo + vbQuestion, "Asking for closing account") If rep = vbYes Then flag = True Connect an = Val(Form1.acnotext.Text) qur = "select * from current_details where account_no=" & an rs.Open qur, con, adOpenDynamic, adLockOptimistic, adCmdText amt = rs.Fields(1) CloseRecordset Disconnect 'MsgBox "Error occured due to these reasons" & vbCrLf & " 1. Witness name is not correct" & vbCrLf & " 2. Witness address is
49
wrong" & vbCrLf & " 3. Witness doesnot hold any account" & vbCrLf & "Please check these things", vbInformation, "Error Occured" MsgBox "your current balance is " & amt & vbCrLf & " First withdraw your amount and your account will be closed", , "Closing Account" Unload Me Form9.Show 1 Else flag = False Exit Sub End If End Sub Private Sub others_Click() Form6.Show 1 End Sub Private Sub others_MouseMove(Button As Integer, Shift As Integer, X As Single, y As Single) Shape9.Visible = False End Sub Private Sub Timer1_Timer() Timer1.Interval = 50 Label3.Left = Label3.Left - 50 If Label3.Left < -50 Then Label3.Left = Screen.Width End If End Sub Private Sub withdrawal_Click() Connect query = "select * from current_details where account_no=" & Form1.acnumber OpenRecordset curbal = rs.Fields(1)
50
CloseRecordset Disconnect Form9.Show 1 End Sub Private Sub withdrawal_MouseMove(Button As Integer, Shift As Integer, X As Single, y As Single) Shape11.Visible = False End Sub
51
52
Private Sub cancel_Click() Unload Me End Sub Private Sub Form_Load() cnumber.Visible = False cdat.Visible = False Label3.Visible = False Label4.Visible = False Label6.Visible = False Shape4.Visible = False Shape5.Visible = False mode = "CASH" Connect rs.Open "transact", con, adOpenDynamic, adLockOptimistic If rs.EOF Then wtn = 100 Else rs.MoveLast wtn = rs.Fields(0) wtn = wtn + 1 End If CloseRecordset Disconnect End Sub Private Sub withdraw_Click() If Form5.flag = True Then If Val(amt.Text) > Form5.amt Then MsgBox "Withdrawal is more than deposit", , "More Withdrawal" Exit Sub End If If Val(amt.Text) < Form5.amt Then
54
MsgBox "Your current balance is " & Form5.amt & vbCrLf & " Please withdraw total amount", , "Less Withdrawal" Exit Sub End If Connect 'DELETING RECORDS FROM WITNESS_DETAILS TABLE ''query = "select * from witness_details where account_no=" & Form1.acnumber ''OpenRecordset ''rs.Delete ''CloseRecordset 'DELETING RECORDS FROM NOMINEE_DETAILS TABLE query = "select * from nominee_details where account_no=" & Form1.acnumber OpenRecordset Do While Not rs.EOF rs.Delete rs.MoveNext Loop CloseRecordset 'DELETING RECORDS FROM CURRENT_DETAILS TABLE query = "select * from current_details where account_no =" & Form1.acnumber OpenRecordset rs.Delete CloseRecordset 'DELETING RECORDS FROM DEPOSIT_DETAILS TABLE query = "select * from deposit_details where account_no =" & Form1.acnumber OpenRecordset Do While Not rs.EOF rs.Delete rs.MoveNext Loop CloseRecordset
55
'DELETING RECORDS FROM WITHDRAW_DETAILS TABLE query = "select * from withdraw_details where account_no=" & Form1.acnumber OpenRecordset Do While Not rs.EOF rs.Delete rs.MoveNext Loop CloseRecordset 'DELETING RECORDS FROM FUND_TRANSFER_DETAILS TABLE query = "select * from fund_transfer_details where account_no=" & Form1.acnumber OpenRecordset Do While Not rs.EOF rs.Delete rs.MoveNext Loop CloseRecordset query = "select * from transact" OpenRecordset rs.AddNew rs.Fields(0) = wtn rs.Fields(1) = Form1.acnumber rs.Fields(2) = "WITHDRAW" rs.Fields(3) = wamt rs.Fields(4) = mode rs.Fields(5) = Date rs.Fields(6) = 0 rs.Fields(7) = "TRUE" rs.Update CloseRecordset 'SETTING CLOSED FIELD OF ACCOUNT_MASTER TABLE TO TRUE AND OPENING BALANCE TO ZERO query = "select * from account_master where account_no=" & Form1.acnumber
56
OpenRecordset rs.Fields("closed") = "TRUE" rs.Fields("opening_amount") = Null rs.Update CloseRecordset Disconnect MsgBox " Thank you for enjoying our banking facilities " & vbCrLf & " Now your account has been closed", , "Account Closed" Me.Hide Form4.Hide End If If chk = True Then Check_All_Fields If m = 1 Then m=0 Exit Sub End If If DateDiff("d", Format(cdat, "mm/dd/yy"), Date) > 180 Then MsgBox "Your cheque is invalid on this date", , "Invalid cheque" Exit Sub Unload Me End If If DateDiff("d", Format(cdat, "mm/dd/yy"), Date) < 0 Then MsgBox "Cheque date is not applicable on this date", , "Not applicable" Exit Sub Unload Me End If wamt = Val(amt.Text) If Form1.mode = "SAVINGS" And Form1.chequefacility = "YES" Then If (Form4.curbal - wamt) < 1500 Then MsgBox "Minimum balance should be maintained RS. 1500", , "More Withdrawal" Exit Sub End If
57
ElseIf Form1.mode = "SAVINGS" And Form1.chequefacility = "NO" Then If (Form4.curbal - wamt) < 1000 Then MsgBox "Minimum balance should be maintained RS. 1000", , "More Withdrawal" Exit Sub End If ElseIf Form1.mode = "CURRENT" And Form1.chequefacility = "YES" Then If (Form4.curbal - wamt) < 3000 Then MsgBox "Minimum balance should be maintained RS. 3000", , "More Withdrawal" Exit Sub End If ElseIf Form1.mode = "CURRENT" And Form1.chequefacility = "NO" Then If (Form4.curbal - wamt) < 2000 Then MsgBox "Minimum balance should be maintained RS. 2000", , "More Withdrawal" Exit Sub End If End If Connect query = "select * from current_details where account_no=" & Form1.acnumber OpenRecordset bal = rs.Fields(1) bal = wamt - bal rs.Fields(1) = bal rs.Update CloseRecordset rs.Open "transact", con, adOpenDynamic, adLockOptimistic, adCmdTable rs.AddNew rs.Fields(0) = wtn
58
rs.Fields(1) = Form1.acnumber rs.Fields(2) = "WITHDRAW" rs.Fields(3) = wamt rs.Fields(4) = mode rs.Fields(5) = Date rs.Fields(6) = bal rs.Update CloseRecordset rs.Open "withdraw_details", con, adOpenDynamic, adLockOptimistic, adCmdTable rs.AddNew rs.Fields(0) = wtn rs.Fields(1) = Form1.acnumber rs.Fields(2) = Val(cnumber.Text) rs.Fields(3) = cdat.Text rs.Fields(4) = Date rs.Update CloseRecordset ElseIf chk = False Then Check_Amount_Only If m = 1 Then m=0 Exit Sub End If wamt = Val(amt.Text) If Form1.mode = "SAVINGS" And Form1.chequefacility = "YES" Then If (Form4.curbal - wamt) < 1500 Then MsgBox "Minimum balance should be maintained RS. 1500", , "More Withdrawal" Exit Sub End If ElseIf Form1.mode = "SAVINGS" And Form1.chequefacility = "NO" Then If (Form4.curbal - wamt) < 1000 Then
59
MsgBox "Minimum balance should be maintained RS. 1000", , "More Withdrawal" Exit Sub End If ElseIf Form1.mode = "CURRENT" And Form1.chequefacility = "YES" Then If (Form4.curbal - wamt) < 3000 Then MsgBox "Minimum balance should be maintained RS. 3000", , "More Withdrawal" Exit Sub End If ElseIf Form1.mode = "CURRENT" And Form1.chequefacility = "NO" Then If (Form4.curbal - wamt) < 2000 Then MsgBox "Minimum balance should be maintained RS. 2000", , "More Withdrawal" Exit Sub End If End If Connect query = "select * from current_details where account_no =" & Form1.acnumber OpenRecordset 'rs.Open "select * from current_details where account_no =" & Form1.acnumber, con, adOpenDynamic, adLockOptimistic, adCmdText bal = rs.Fields(1) bal = bal - wamt rs.Fields(1) = bal rs.Update CloseRecordset query = "select * from transact" OpenRecordset 'rs.Open "transact", con, adOpenDynamic, adLockOptimistic, adCmdTable
60
rs.AddNew rs.Fields(0) = wtn rs.Fields(1) = Form1.acnumber rs.Fields(2) = "WITHDRAW" rs.Fields(3) = wamt rs.Fields(4) = mode rs.Fields(5) = Date rs.Fields(6) = bal rs.Update CloseRecordset End If Disconnect wid = 1 Unload Me Form15.Show 1 End Sub Private Sub Check_Amount_Only() If amt.Text = "" Then MsgBox "Enter amount to deposit", , "Caution.." amt.SetFocus m=1 Exit Sub ElseIf Not IsNumeric(amt.Text) Then MsgBox "Must be entered numeric values", , "caution" amt.SetFocus SendKeys "{home}+{end}" m=1 Exit Sub End If End Sub Private Sub Check_All_Fields() If amt.Text = "" Then MsgBox "Enter amount to deposit", , "Caution.."
61
amt.SetFocus m=1 Exit Sub ElseIf Not IsNumeric(amt.Text) Then MsgBox "Must be entered numeric values", , "caution" amt.SetFocus SendKeys "{home}+{end}" m=1 Exit Sub ElseIf cnumber.Text = "" Then MsgBox "Enter cheque number", , "Caution" cnumber.SetFocus m=1 Exit Sub ElseIf Len(cnumber.Text) <> 6 Then MsgBox "Cheque number must be of 6 digits", , "Caution" cnumber.SetFocus SendKeys "{home}+{end}" m=1 Exit Sub ElseIf Not IsNumeric(cnumber.Text) Then MsgBox "Cheque number must be a number type", , "Caution" cnumber.SetFocus SendKeys "{home}+{end}" m=1 Exit Sub ElseIf cdat.Text = "" Then MsgBox "Cheque date must be given", , "Caution" cdat.SetFocus m=1 Exit Sub ElseIf Not IsDate(cdat.Text) Then MsgBox "Must be entered cheque date", , "Caution" cdat.SetFocus SendKeys "{home}+{end}"
62
63
Label4.Visible = True Label5.Visible = True Label6.Visible = True cbo.Visible = True Label6.Visible = True Shape4.Visible = True Shape5.Visible = True End Sub Private Sub cancel_Click() Unload Me End Sub Private Sub deposit_Click() If chk = True Then Check_All_Fields If m = 1 Then m=0 Exit Sub End If If DateDiff("d", Format(cdat, "mm/dd/yy"), Date) > 180 Then MsgBox "Your cheque is invalid in this date", , "Invalid cheque" Exit Sub Unload Me End If If DateDiff("d", Format(cdat, "mm/dd/yy"), Date) < 0 Then MsgBox "Cheque date is not applicable on this date", , "Not applicable" Exit Sub Unload Me End If damt = Val(amt.Text) Connect query = "select * from current_details where account_no=" & Form1.acnumber OpenRecordset
65
bal = rs.Fields(1) bal = bal + damt rs.Fields(1) = bal rs.Update CloseRecordset query = "select * from transact" OpenRecordset rs.AddNew rs.Fields(0) = dtn rs.Fields(1) = Form1.acnumber rs.Fields(2) = "DEPOSIT" rs.Fields(3) = damt rs.Fields(4) = mode rs.Fields(5) = Date rs.Fields(6) = bal rs.Update CloseRecordset query = "select * from deposit_details" OpenRecordset rs.AddNew rs.Fields(0) = dtn rs.Fields(1) = Form1.acnumber rs.Fields(2) = cnumber.Text rs.Fields(3) = cdat.Text rs.Fields(4) = cbo.Text rs.Fields(5) = DateAdd("d", 3, Date) rs.Update CloseRecordset ElseIf chk = False Then Check_Amount_Only If m = 1 Then m=0 Exit Sub End If damt = Val(amt.Text)
66
Connect query = "select * from current_details where account_no =" & Form1.acnumber OpenRecordset bal = rs.Fields(1) bal = bal + damt rs.Fields(1) = bal rs.Update CloseRecordset query = "select * from transact" OpenRecordset rs.AddNew rs.Fields(0) = dtn rs.Fields(1) = Form1.acnumber rs.Fields(2) = "DEPOSIT" rs.Fields(3) = damt rs.Fields(4) = mode rs.Fields(5) = Date rs.Fields(6) = bal rs.Update CloseRecordset End If Disconnect dep = 1 Unload Me Form15.Show 1 End Sub Private Sub Check_Amount_Only() If amt.Text = "" Then MsgBox "Enter amount to deposit", , "Caution.." amt.SetFocus m=1 Exit Sub ElseIf Not IsNumeric(amt.Text) Then
67
MsgBox "Must be entered numeric values", , "caution" amt.SetFocus SendKeys "{home}+{end}" m=1 Exit Sub End If End Sub Private Sub Form_Load() cnumber.Visible = False cdat.Visible = False Label3.Visible = False Label4.Visible = False Label5.Visible = False Label6.Visible = False cbo.Visible = False Label6.Visible = False Shape4.Visible = False Shape5.Visible = False mode = "CASH" Connect query = "select * from transact" OpenRecordset 'rs.Open "transact", con, adOpenDynamic, adLockOptimistic If rs.EOF Then dtn = 100 Else rs.MoveLast dtn = rs.Fields(0) dtn = dtn + 1 End If CloseRecordset Disconnect End Sub
68
Private Sub Check_All_Fields() If amt.Text = "" Then MsgBox "Enter amount to deposit", , "Caution.." amt.SetFocus m=1 Exit Sub ElseIf Not IsNumeric(amt.Text) Then MsgBox "Must be entered numeric values", , "caution" amt.SetFocus SendKeys "{home}+{end}" m=1 Exit Sub ElseIf cnumber.Text = "" Then MsgBox "Enter cheque number", , "Caution" cnumber.SetFocus m=1 Exit Sub ElseIf Len(cnumber.Text) <> 6 Then MsgBox "Cheque number must be of 6 digits", , "Caution" cnumber.SetFocus SendKeys "{home}+{end}" m=1 Exit Sub ElseIf Not IsNumeric(cnumber.Text) Then MsgBox "Cheque number must be a number type", , "Caution" cnumber.SetFocus SendKeys "{home}+{end}" m=1 Exit Sub ElseIf cdat.Text = "" Then MsgBox "Cheque date must be given", , "Caution" cdat.SetFocus m=1 Exit Sub ElseIf Not IsDate(cdat.Text) Then
69
MsgBox "Must be entered cheque date", , "Caution" cdat.SetFocus SendKeys "{home}+{end}" m=1 Exit Sub End If End Sub
70
If Val(acnumber.Text) = Form1.acnumber Then MsgBox "You cannot transfer money to your account", , "Transfer Problem" acnumber.SetFocus SendKeys "{home}+{end}" Exit Sub End If Connect rs.Open "select * from current_details where account_no=" & Val(acnumber.Text), con, adOpenDynamic, adLockOptimistic If rs.EOF Then MsgBox "Such account number does not exist", , "Error..." CloseRecordset Disconnect Exit Sub Else CloseRecordset rs.Open "select * from current_details where account_no =" & Form1.acnumber, con, adOpenDynamic, adLockOptimistic bal = rs.Fields(1) bal = bal - Val(amt.Text) If bal < minbal Then MsgBox "You cannot transfer money more than deposits" & vbCrLf & " You cannot leave your account to zero balance" & vbCrLf & " You have to maintain minimum balance of Rs = " & minbal, , "Error.." CloseRecordset Disconnect Exit Sub End If rs.Fields(1) = bal rs.Update CloseRecordset query = "select * from current_details where account_no=" & Val(acnumber.Text) OpenRecordset
72
bal = rs.Fields(1) bal = bal + Val(amt.Text) rs.Fields(1) = bal rs.Update CloseRecordset rs.Open "fund_transfer_details", con, adOpenDynamic, adLockOptimistic rs.AddNew rs.Fields(0) = Form1.acnumber rs.Fields(1) = Val(amt.Text) rs.Fields(2) = Val(acnumber.Text) rs.Fields(3) = Date rs.Update CloseRecordset Disconnect MsgBox Val(amt.Text) & " amount transferred to " & Val(acnumber.Text) & " account number", , "Successfully Transferred" Unload Me End If End Sub
73
Text1(1).Text = rs.Fields(3) Text1(2).Text = rs.Fields(6) Text1(3).Text = rs.Fields(8) Text1(4).Text = rs.Fields(9) Else optjoint.Value = True Text1(0).Text = rs.Fields(1) Text1(1).Text = rs.Fields(3) Text1(2).Text = rs.Fields(6) Text1(3).Text = rs.Fields(8) Text1(4).Text = rs.Fields(9) Text1(5).Text = rs.Fields(4) Text1(6).Text = rs.Fields(5) Text1(7).Text = rs.Fields(7) End If If rs.Fields(11) = "SAVINGS" Then optsaving.Value = True Else optcurrent.Value = True End If If rs.Fields(10) = "YES" Then optyes.Value = True Else optno.Value = True End If End Sub Private Sub modify_Click() rs.Fields(1) = UCase(Text1(0).Text) rs.Fields(3) = Val(Text1(1).Text) rs.Fields(6) = UCase(Text1(2).Text) rs.Fields(8) = UCase(Text1(3).Text) rs.Fields(9) = Text1(4).Text If num = 1 Then rs.Fields(4) = ""
75
rs.Fields(5) = Null rs.Fields(7) = "" Else rs.Fields(4) = UCase(Text1(5).Text) rs.Fields(5) = Val(Text1(6).Text) rs.Fields(7) = UCase$(Text1(7).Text) End If rs.Fields(11) = atype rs.Fields(10) = cf rs.Fields("mode") = md rs.Update MsgBox "Account details successfully modified", vbOKOnly + vbInformation, "Account Modified" CloseRecordset Disconnect Unload Me End Sub Private Sub optyes_Click() cf = "YES" End Sub Private Sub optno_Click() cf = "NO" End Sub Private Sub optsaving_Click() atype = "SAVINGS" End Sub Private Sub optcurrent_Click() atype = "CURRENT" End Sub Private Sub optsingel_Click()
76
md = "SINGLE" jacname.Enabled = False jacage.Enabled = False jacoccup.Enabled = False Text1(5).Visible = False Text1(6).Visible = False Text1(7).Visible = False Shape8.Visible = False Shape9.Visible = False Shape10.Visible = False num = 1 End Sub Private Sub optjoint_Click() md = "JOINT" jacname.Enabled = True jacage.Enabled = True jacoccup.Enabled = True Text1(5).Visible = True Text1(6).Visible = True Text1(7).Visible = True Shape8.Visible = True Shape9.Visible = True Shape10.Visible = True num = 2 End Sub Private Sub Text1_GotFocus(Index As Integer) SendKeys "{HOME}+{END}" End Sub
77
For X = 1 To 5 MSHFlexGrid1.Col = X MSHFlexGrid1.Row = RowCount MSHFlexGrid1.Text = rs.Fields(X + 1) Next X If rs.Fields(2) = "DEPOSIT" Then a = a + rs.Fields(6) ElseIf rs.Fields(2) = "WITHDRAW" Then a = a - rs.Fields(6) End If rs.MoveNext Loop CloseRecordset Disconnect End Sub
79