This document is a report submitted by Sachin Foujdar for his Bachelor of Computer Application degree. It details the development of an ATM application created in Visual Basic. The application uses event-driven programming concepts and connects to an Access database. Sachin thanks his mentor for assistance in creating the project and his college for providing the opportunity. Code snippets are included that show functions for logging into the ATM, performing transactions, creating new accounts, and updating accounts.
1. Visual basic Assignment
Submitted By
Sachin Foujdar
BCA – 3rd Year
Dezyne E’ cole College
106/10, Civil Lines, Ajmer
Tel: 0145-2624679
www.dezyneecole.com
2015-2016
A WORK REPORT SUBMITTED
IN PARTIAL FULLFILLMENT OF THE REQUIREMENT FOR
THE DEGREE
Bachelor of Computer Application
2. Acknowledgement
This application(ATM) create in “Visual Basic” was developed at Dezyne
E’cole College.
The Following code represent is based on event driven programming
concept that are based on concept of event that are perform and executed
at run time.
During the making of this project I have learnt a lot and I thank my mentor
Mr. Tarun Sharma for helping us during the making of project.
I thank my college “Dezyne E’cole College” for having conducted this
“Identity” exhibition for helping us to bring out our skill.
With due Regards,
Sachin Foujdar
BCA 3rd Year
4. Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim a As Integer
Private Sub Command1_Click()
If tid.Text = "" Then
MsgBox ("Enter Your Account Number")
ElseIf tpswd.Text = "" Then
MsgBox ("Enter The Password")
Else
Timer1.Enabled = True
Label5.Visible = True
Label6.Visible = True
Set rs = New Recordset
rs.Open "select * from NewAccount where Acc_No='" &
tid.Text & "' and Password='" & tpswd.Text & "'", cn,
adOpenKeyset, adLockPessimistic
If rs.RecordCount <> 0 Then
If a = 3 Then
Form3.Show
Form3.Enabled = True
Unload Me
End If
Else
MsgBox ("Invalid User Account Number or Password"),
vbCritical
Timer1.Enabled = False
Label5.Visible = False
Label6.Visible = False
End If
End Sub
Source Code
5. Private Sub Command2_Click()
Option1.Enabled = True
Option3.Enabled = True
Option4.Enabled = True
End Sub
Private Sub Form_Activate()
Form2.Height = Screen.Height
Form2.Width = Screen.Width
Form2.Top = 0
Form2.Left = 0
Form2.BackColor = RGB(23, 116, 222)
Option1.BackColor = RGB(23, 116, 222)
Option3.BackColor = RGB(23, 116, 222)
Option4.BackColor = RGB(23, 116, 222)
tid.SetFocus
End Sub
Private Sub Form_Load()
Set cn = New Connection
cn.ConnectionString =
"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=AtmDatabase.mdb;Persist Security Info=False"
cn.Open
Form2.Enabled = True
Option1.Enabled = False
Option3.Enabled = False
Option4.Enabled = False
End Sub
Private Sub Option1_Click()
Unload Me
form4.Show
End Sub
6. Private Sub Option3_Click()
Unload Me
End Sub
Private Sub Option4_Click()
Unload Me
Form9.Show
End Sub
Private Sub tid_lostfocus()
tpswd.SetFocus
End Sub
Private Sub Timer1_Timer()
If a = 0 Then
Label6.Caption = " "
Label6.Caption = "."
a = 1
ElseIf a = 1 Then
Label6.Caption = " "
Label6.Caption = ". ."
a = 2
ElseIf a = 2 Then
Label6.Caption = " "
Label6.Caption = ". . ."
a = 3
ElseIf a = 3 Then
Label6.Caption = " "
Label6.Caption = ". . . ."
Form3.Show
Form3.Enabled = True
Unload Me
End If
End Sub
7. Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim m, p As Variant
Private Sub Command1_Click()
If Text1.Text = "" And Text2.Text = "" And Text3.Text = ""
And Text4.Text = "" And Text5.Text = "" And Text6.Text =
"" And Text10.Text = "" Then
MsgBox ("All Feilds are Requried")
Source Code
8. Else
Set rs = New Recordset
rs.Open "select * from NewAccount", cn, adOpenKeyset,
adLockPessimistic
Do Until rs.EOF
If Val(rs.Fields(7).Value) > m Then
m = rs.Fields(7).Value
p = rs.Fields(8).Value
End If
rs.MoveNext
Loop
m = Val(m) + 1
p = Val(p) + 1
Form10.Label2.Caption = m
Form10.Label5.Caption = p
With rs
rs.AddNew
rs.Fields(0) = Text1.Text
rs.Fields(1) = Text2.Text
rs.Fields(2) = Text3.Text
rs.Fields(3) = Option1.Caption
rs.Fields(4) = Text4.Text
rs.Fields(5) = Text5.Text
rs.Fields(6) = Text6.Text
rs.Fields(7) = Form10.Label2.Caption
rs.Fields(8) = Form10.Label5.Caption
rs.Fields(9) = Val(Text10.Text)
rs.Update
End With
MsgBox ("Your Account has been created"),
vbInformation
9. Unload Me
Form10.Show
End If
End Sub
Private Sub Command2_Click()
Unload Me
Form2.Show
End Sub
Private Sub Form_Activate()
form4.Height = Form1.Height
form4.Width = Form1.Width
form4.Top = 0
form4.Left = 0
form4.BackColor = RGB(23, 116, 222)
Text1.SetFocus
End Sub
Private Sub Form_Load()
Set cn = New Connection
cn.ConnectionString =
"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=AtmDatabase.mdb;Persist Security Info=False"
cn.Open
End Sub
10. Private Sub Form_Activate()
Form5.Height = Form1.Height
Form5.Width = Form1.Width
Form5.Top = 0
Form5.Left = 0
Form5.BackColor = RGB(23,
116, 222)
End Sub
Source Code
11. Private Sub Form_Load()
Label4.Visible = False
Label5.Visible = False
Set cn = New Connection
cn.ConnectionString =
"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=AtmDatabase.mdb;Persist Security Info=False"
cn.Open
End Sub
Private Sub Timer1_Timer()
If a = 0 Then
Label5.Caption = " "
Label5.Caption = "."
a = 1
ElseIf a = 1 Then
Label5.Caption = " "
Label5.Caption = ". ."
a = 2
ElseIf a = 2 Then
Label5.Caption = " "
Label5.Caption = ". . ."
MsgBox ("Your Account has been updated")
a = 3
ElseIf a = 3 Then
Label5.Caption = " "
Label5.Caption = ". . . ."
Form3.Show
Form3.Enabled = True
Unload Me
End If
End Sub