banking system visual basic by danish kanojia (forms and code)

16

Upload: djdan143

Post on 18-Jun-2015

4.447 views

Category:

Documents


4 download

DESCRIPTION

Complete Forms and Coding of Banking System .Made by Danish Kanojia

TRANSCRIPT

Page 1: Banking System Visual Basic by Danish Kanojia (Forms and Code)
Page 2: Banking System Visual Basic by Danish Kanojia (Forms and Code)

Dim r As Integer

Private Sub Command1_Click()Form4.ShowEnd Sub

Private Sub Command2_Click()r = MsgBox("Are You Sure You want to Exit?", vbYesNo, "QUIT")If r = vbYes ThenEndEnd IfEnd Sub

Private Sub Command3_Click()Form6.ShowEnd Sub

Private Sub Command4_Click()Form5.ShowEnd Sub

Page 3: Banking System Visual Basic by Danish Kanojia (Forms and Code)
Page 4: Banking System Visual Basic by Danish Kanojia (Forms and Code)

Private Sub Command1_Click()If Text1.Text = "" Then 'IF 1 START (NAME) MsgBox "Please Enter the name of the Account holder", vbInformation, "NAME" Call Command4_Click Exit Sub ' EXIT IF 1End If ' END IF 1If Text2.Text = "" Then ' IF 2 START (ACNO) MsgBox "Please Enter a Valid Account Number", vbInformation, "A/c No" Call Command4_Click Exit Sub ' EXIT IF 2End If ' END IF 2With Data1 'WITH 1 START .Recordset.MoveFirst Do Until .Recordset.EOF ' DO UNTIL 1 START If .Recordset.Fields("Acno") = Val(Text2.Text) Then 'IF 3 START MsgBox "Account Already exists!!", vbCritical, "A/C No." 'CHECKING EXISTING ACCOUNT Call Command4_Click Exit Sub 'EXIT IF 3 Else ' ELSE 3 .Recordset.MoveNext End If 'IF 3 CLOSE Loop ' DO UNTIL 1 CLOSEEnd With 'WITH 1 CLOSEIf Text3.Text = "" Then ' IF 4 START (GAURANTER ) MsgBox "Please Enter a Gauranter Name", vbInformation, "Gauranter Name" Call Command4_Click Exit Sub ' EXIT IF 4End If ' END IF 4With Data1 ' WITH 2 START k = 0 .Recordset.MoveFirst Do Until .Recordset.EOF 'DO UNTIL 2 START If .Recordset.Fields("Cname") = Text3.Text Then ' IF 5 START k = 1 Else 'ELSE 5 .Recordset.MoveNext End If ' IF 5 CLOSE Loop ' DO UNTIL 2 CLOSE If k = 0 Then ' IF 6 START (CHECKING EXISTING CUSTOMERS FOR GAURANTEE) MsgBox "Please Enter a Valid Gauranter Name", vbCritical, "Gauranter Name" Call Command4_Click Exit Sub ' EXIT IF 6 End If ' END IF 6End With ' END WITH 2

Page 5: Banking System Visual Basic by Danish Kanojia (Forms and Code)

If Text4.Text = "" Or Val(Text4.Text) <= 999 Then 'IF 7 START (INITIAL DEPOSIT 1000) MsgBox "Please Enter Some Initial Amount Greater than Rs 1000", vbInformation, "INITIAL AMOUNT" Call Command4_Click Exit Sub ' EXIT IF 7End If ' IF 7 CLOSE

c = MsgBox("Are You Sure You Want to Create this Account?", vbYesNo, "Confirm")If c = vbYes Then ' IF 8 START With Data1 ' WITH 3 START .Recordset.AddNew .Recordset.Fields("Cname") = Text1.Text .Recordset.Fields("Acno") = Val(Text2.Text) .Recordset.Fields("Amount") = Val(Text4.Text) .Recordset.Update End With ' END WITH 3End If ' IF 8 ENDCall Command4_ClickExit SubEnd Sub

Private Sub Command2_Click()With Data1.Recordset.MoveFirstDo Until .Recordset.EOFIf .Recordset.Fields("Cname") = Text1.Text And .Recordset.Fields("Acno") = Text2.Text Thenc = MsgBox("Are You Sure You Want to Delete this Account?", vbYesNo, "Confirm") If c = vbYes Then .Recordset.Delete .Recordset.Update MsgBox "Account deleted successfully!!", vbInformation, "DELETE" Exit Sub End IfElse.Recordset.MoveNextEnd IfLoopEnd With MsgBox "No Such Record Exist", vbInformation, "Recordset not found!!"End Sub

Private Sub Command3_Click() ' CANCEL Me.Hide Form3.Show

Page 6: Banking System Visual Basic by Danish Kanojia (Forms and Code)

End Sub

Private Sub Command4_Click() ' RESET Text1.Text = "" Text2.Text = "" Text3.Text = "" Text4.Text = "" Text1.SetFocusEnd Sub

Private Sub Form_Load()Data1.DatabaseName = App.Path & "\Hsbc.mdb"End Sub

Page 7: Banking System Visual Basic by Danish Kanojia (Forms and Code)
Page 8: Banking System Visual Basic by Danish Kanojia (Forms and Code)

Private Sub ProgressBar1_Click()

End Sub

Private Sub Timer1_Timer()Label1.Left = Label1.Left + 35Label2.Left = Label2.Left - 35

If Label1.Left = 6860 And Label2.Left = 7180 ThenLabel3.Visible = TrueLabel4.Visible = TrueTimer1.Enabled = FalseTimer2.Enabled = FalseLabel6.Caption = ""Form2.ShowEnd IfEnd Sub

Private Sub Timer2_Timer()i = i + 1ProgressBar1.Value = ProgressBar1.Value + 10Select Case iCase 1Label5.Caption = "Loading Forms..."Case 5Label5.Caption = "Connecting Database..."Case 12Label5.Caption = "Preparing User Inteface..."Case 17Label5.Caption = "Checking Connectivity..."Case 21Label5.Caption = "Preparing Accounts Info..."Case 23Label5.Caption = "Preparations Complete!!!"End SelectEnd Sub

Page 9: Banking System Visual Basic by Danish Kanojia (Forms and Code)

Private Sub Form_Load()Data1.DatabaseName = App.Path & "\Hsbc.mdb"End Sub

Page 10: Banking System Visual Basic by Danish Kanojia (Forms and Code)
Page 11: Banking System Visual Basic by Danish Kanojia (Forms and Code)

Private Sub Command1_Click()With Data1.Recordset.MoveFirstDo Until .Recordset.EOFIf (.Recordset.Fields("Username") = Text1.Text And .Recordset.Fields("Password") = Text2.Text) ThenMsgBox "Access Granted", vbInformation, " Login Succeed"Form3.ShowUnload MeExit SubElse.Recordset.MoveNextEnd IfLoopMsgBox "Access Denied", vbCritical, "Login Failed"Text1.Text = ""Text2.Text = ""Text1.SetFocusEnd WithEnd Sub

Private Sub Command2_Click()If i = 0 Then Text1.Text = "ADMIN" Text2.SetFocus Command1.Visible = False Command2.Caption = "OK" i = 1ElseIf i = 1 Then If Text1.Text = "ADMIN" And Text2.Text = "DANISH" Then Label1.Caption = "New Username" Text1.Text = "" Text2.Text = "" Text1.SetFocus i = 2 Else MsgBox "Access Denied", vbCritical, "Login Failed" End If ElseIf i = 2 ThenWith Data1.Recordset.MoveFirstDo Until .Recordset.EOFIf .Recordset.Fields("Username") = Text1.Text Then

Page 12: Banking System Visual Basic by Danish Kanojia (Forms and Code)

MsgBox "Username Already Exist! Please select any other Username.", vbInformation, "Username" Text1.Text = "" Text2.Text = "" Text1.SetFocusElse .Recordset.MoveNextEnd IfLoop .Recordset.AddNew .Recordset.Fields("Username") = Text1.Text .Recordset.Fields("Password") = Text2.Text .Recordset.Update .Recordset.MoveFirst End With Call Form_Load Exit SubEnd IfEnd Sub

Private Sub Form_Load()Data1.DatabaseName = App.Path & "\Hsbc.mdb"Command1.Caption = "OK"Command2.Caption = "Add User!!"Command1.Visible = TrueLabel1.Caption = "Username"Text1.Text = ""Text2.Text = ""i = 0End Sub

Page 13: Banking System Visual Basic by Danish Kanojia (Forms and Code)
Page 14: Banking System Visual Basic by Danish Kanojia (Forms and Code)

Private Sub Command2_Click()c = 1Form5.Height = 5595Frame1.Visible = FalseEnd Sub

Private Sub Command3_Click()c = 2Form5.Height = 5595Frame1.Visible = TrueEnd Sub

Private Sub Command4_Click()Me.Hide Form3.ShowEnd Sub

Private Sub Command5_Click()If Text1.Text = "" ThenMsgBox "Please enter the Amount", vbInformation, "AMOUNT"Exit SubEnd IfIf c = 1 Then ' withdraw Data1.Recordset.Edit Data1.Recordset("Amount") = Data1.Recordset("Amount") - Val(Text2.Text) Data1.Recordset.Update MsgBox "Amount Withdrawn", vbInformation, "WITHDRAW" Text2.Text = "" Call Form_Load Exit SubElseIf c = 2 Then 'deposit If (Option1.Value = False) And (Option2.Value = False) Then MsgBox "Please Select a Deposit Mode", vbInformation, "DEPOSIT MODE" Else Data1.Recordset.Edit Data1.Recordset("Amount") = Data1.Recordset("Amount") + Val(Text2.Text) Data1.Recordset.Update MsgBox "Amount Deposited", vbInformation, "DEPOSIT" Text2.Text = "" Call Form_Load Exit Sub End IfEnd IfEnd Sub

Private Sub Form_Load()

Page 15: Banking System Visual Basic by Danish Kanojia (Forms and Code)

Text1.Text = ""Label3.Caption = ""Label4.Caption = ""Label5.Caption = ""Command2.Enabled = FalseCommand3.Enabled = Falsec = 0Data1.DatabaseName = App.Path & "\Hsbc.mdb"Form5.Height = 4155End Sub