Salah satu tugas siswa tingkat 1 RPL ( Rekayatsa Perangkat Lunak ) adalah membuat "Project Aplikasi menggunakan Visual Basic 6.0. Berikut Hasil Karyanya :
1. Nama Database : BANK.mdb
Tabelnya adalah sbb :
2. User Interface / Design Form
3. Menu Aplikasi
4. Laporan
- Lap. Nasabah
- Lap. Teller
- Lap Penyetoran
- Lap. Penarikan
5. Coding-nya adalah sbb :
Form Nasabah
Private Sub cmdedit_Click()
Data1.Recordset.Edit
Data1.Recordset!no_rekening = Text1.Text
Data1.Recordset!nama_nasabah =
Text2.Text
Data1.Recordset!jenis_kelamin =
Text3.Text
Data1.Recordset!alamat = Text4.Text
Data1.Recordset!saldo = Text5.Text
Data1.Recordset.Update
Data1.Refresh
DBGrid1.Refresh
cmdedit.Enabled = False
End Sub
Private Sub cmdend_Click()
X = MsgBox("yakin ingin
keluar?", vbQuestion + vbOKCancel, "konfirmasi")
If X = vbOK Then
Unload Me
End If
End Sub
Private Sub cmdhapus_Click()
If MsgBox("Apakah Yakin Barang
" + Txtnmbrg + "Akan dihapus ?", vbQuestion + vbYesNo) = vbYes
Then
Data1.Recordset.Delete
Call bersih
End If
End Sub
Private Sub cmdsimpan_Click()
Data1.Recordset.AddNew
Data1.Recordset!no_rekening = Text1.Text
Data1.Recordset!nama_nasabah =
Text2.Text
Data1.Recordset!jenis_kelamin =
Text3.Text
Data1.Recordset!alamat = Text4.Text
Data1.Recordset!saldo = Text5.Text
Data1.Recordset.Update
Data1.Refresh
DBGrid1.Refresh
Call bersih
cmdsimpan.Enabled = False
cmdtambah.Enabled = True
Call nonaktif
End Sub
Private Sub cmdtambah_Click()
Call aktif
cmdtambah.Enabled = False
cmdedit.Enabled = False
cmdhapus.Enabled = False
Text1.SetFocus
End Sub
Private Sub DBGrid1_Click()
Text1.Text = Data1.Recordset!no_rekening
Text2.Text =
Data1.Recordset!nama_nasabah
Text3.Text =
Data1.Recordset!jenis_kelamin
Text4.Text = Data1.Recordset!alamat
Text5.Text = Data1.Recordset!saldo
cmdedit.Enabled = True
cmdsimpan.Enabled = True
cmdhapus.Enabled = True
cmdtambah.Enabled = True
End Sub
Sub nonaktif()
Text1.Enabled = False
Text2.Enabled = False
Text3.Enabled = False
Text4.Enabled = False
Text5.Enabled = False
DBGrid1.Enabled = False
cmdsimpan.Enabled = False
cmdedit.Enabled = False
cmdhapus.Enabled = False
End Sub
Sub aktif()
Text1.Enabled = True
Text2.Enabled = True
Text3.Enabled = True
Text4.Enabled = True
Text5.Enabled = True
Call bersih
DBGrid1.Enabled = True
cmdsimpan.Enabled = True
cmdedit.Enabled = True
cmdhapus.Enabled = True
End Sub
Sub bersih()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
End Sub
Private Sub form_load()
Call nonaktif
End Sub
Form Teller
Private Sub cmdedit_Click()
Data1.Recordset.Edit
Data1.Recordset!ID_teller = Text1.Text
Data1.Recordset!nama_teller = Text2.Text
Data1.Recordset!jenis_kelamin = Text3.Text
Data1.Recordset!no_telepon = Text4.Text
Data1.Recordset!alamat = Text5.Text
Data1.Recordset.Update
Data1.Refresh
DBGrid1.Refresh
cmdedit.Enabled = False
End Sub
Private Sub cmdend_Click()
X = MsgBox("yakin ingin keluar?", vbQuestion + vbOKCancel,
"konfirmasi")
If X = vbOK Then
Unload Me
End If
End Sub
Private Sub cmdhapus_Click()
If MsgBox("Apakah Yakin Barang " + Txtnmbrg + "Akan
dihapus ?", vbQuestion + vbYesNo) = vbYes Then
Data1.Recordset.Delete
Call bersih
End If
End Sub
Private Sub cmdsimpan_Click()
Data1.Recordset.AddNew
Data1.Recordset!ID_teller = Text1.Text
Data1.Recordset!nama_teller = Text2.Text
Data1.Recordset!jenis_kelamin = Text3.Text
Data1.Recordset!no_telepon = Text4.Text
Data1.Recordset!alamat = Text5.Text
Data1.Recordset.Update
Data1.Refresh
DBGrid1.Refresh
Call bersih
cmdsimpan.Enabled = False
cmdtambah.Enabled = True
Call nonaktif
End Sub
Private Sub cmdtambah_Click()
Call aktif
cmdtambah.Enabled = False
cmdedit.Enabled = False
cmdhapus.Enabled = False
Text1.SetFocus
End Sub
Private Sub DBGrid1_Click()
Text1.Text = Data1.Recordset!ID_teller
Text2.Text = Data1.Recordset!nama_teller
Text3.Text = Data1.Recordset!jenis_kelamin
Text4.Text = Data1.Recordset!no_telepon
Text5.Text = Data1.Recordset!alamat
cmdedit.Enabled = True
cmdsimpan.Enabled = True
cmdhapus.Enabled = True
cmdtambah.Enabled = True
End Sub
Sub nonaktif()
Text1.Enabled = False
Text2.Enabled = False
Text3.Enabled = False
Text4.Enabled = False
Text5.Enabled = False
DBGrid1.Enabled = False
cmdsimpan.Enabled = False
cmdedit.Enabled = False
cmdhapus.Enabled = False
End Sub
Sub aktif()
Text1.Enabled = True
Text2.Enabled = True
Text3.Enabled = True
Text4.Enabled = True
Text5.Enabled = True
Call bersih
DBGrid1.Enabled = True
cmdsimpan.Enabled = True
cmdedit.Enabled = True
cmdhapus.Enabled = True
End Sub
Sub bersih()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
End Sub
Private Sub form_load()
Call nonaktif
End Sub
Form Setor
Private Sub DBGrid2_Click()
DBrekening.Text = Data1.Recordset!no_rekening
Text10.Text = Data1.Recordset!alamat
Text11.Text = Data1.Recordset!jenis_kelamin
Text5.Text = Data1.Recordset!nama_nasabah
Text8.Text = Data1.Recordset!saldo
End Sub
Private Sub cmdedit_Click()
Data3.Recordset!no_setoran = Text1.Text
Data3.Recordset!ID_teller = DBteller.Text
Data3.Recordset!no_rekening = DBrekening.Text
Data3.Recordset!tanggal_setor = Text3.Text
Data3.Recordset!jam_setor = Text4.Text
Data3.Recordset!jumlah_setor = "Rp." & Text7.Text
Data3.Recordset!saldo_akhir = "Rp." & Text8.Text
Data3.Recordset.Update
DBGrid1.Refresh
cmdedit.Enabled = False
End Sub
Private Sub cmdhapus_Click()
If MsgBox("yakin ingin menghapus data?", vbQuestion +
vbOKCancel, "konfirmasi") = vbOK Then
Data3.Recordset.Delete
cmdedit.Enabled = False
Me.Data3.Refresh
End If
End Sub
Private Sub cmdkeluar_Click()
X = MsgBox("Are You Sure To Quit?", vbQuestion + vbOKCancel,
"konfirmation")
If X = vbOK Then
Unload Me
End If
End Sub
Private Sub cmdok_Click()
Data1.Recordset.Edit
Data1.Recordset!no_rekening = DBrekening.Text
Data1.Recordset!nama_nasabah = Text5.Text
Data1.Recordset!jenis_kelamin = Text11.Text
Data1.Recordset!alamat = Text10.Text
Data1.Recordset!saldo = Text8.Text
Data1.Recordset.Update
DBGrid2.Refresh
End Sub
Private Sub cmdsimpan_Click()
Data3.Recordset.AddNew
Data3.Recordset!no_setoran = Text1.Text
Data3.Recordset!ID_teller = DBteller.Text
Data3.Recordset!no_rekening = DBrekening.Text
Data3.Recordset!tanggal_setor = Text3.Text
Data3.Recordset!jam_setor = Text4.Text
Data3.Recordset!jumlah_setor = "Rp." & Text7.Text
Data3.Recordset!saldo_akhir = "Rp." & Text8.Text
Data3.Recordset.Update
DBGrid1.Refresh
Call bersih
cmdsimpan.Enabled = False
cmdtambah.Enabled = True
Call non_aktif
End Sub
Private Sub cmdtambah_Click()
Call aktif
cmdtambah.Enabled = False
cmdedit.Enabled = False
cmdhapus.Enabled = False
Text3.Text = Format(Date, "DD/MM/YYYY")
Text4.Text = Format(Now, "h:mm:ss")
Text1.SetFocus
End Sub
Private Sub DBGrid1_Click()
Text1.Text = Data3.Recordset!no_setoran
DBteller.Text = Data3.Recordset!ID_teller
DBrekening.Text = Data3.Recordset!no_rekening
Text3.Text = Data3.Recordset!tanggal_setor
Text4.Text = Data3.Recordset!jam_setor
Text7.Text = Data3.Recordset!jumlah_setor
Text8.Text = Data3.Recordset!saldo_akhir
Text3.Enabled = False
Text4.Enabled = False
cmdedit.Enabled = True
cmdsimpan.Enabled = False
cmdtambah.Enabled = True
cmdhapus.Enabled = True
End Sub
Private Sub DBrekening_Change()
Data1.Recordset.Index = "no_rekening"
Data1.Recordset.Seek "=", DBrekening.Text
If Not Data1.Recordset.NoMatch Then
Text6.Text = Data1.Recordset!saldo
End If
End Sub
Private Sub DBteller_Change()
Data2.Recordset.Index = "ID_teller"
Data2.Recordset.Seek "=", DBteller.Text
If Not Data2.Recordset.NoMatch Then
Text2.Text = Data2.Recordset!nama_teller
End If
End Sub
Private Sub form_load()
Call non_aktif
End Sub
Private Sub Text7_Change()
Text8.Text = Val(Text6.Text) + Val(Text7.Text)
End Sub
Private Sub timer1_timer()
lblwaktu.Caption = Format(Now, "hh:mm:ss")
End Sub
Sub non_aktif()
Text1.Enabled = False
Text2.Enabled = False
Text3.Enabled = False
Text4.Enabled = False
Text5.Enabled = False
Text6.Enabled = False
Text7.Enabled = False
Text8.Enabled = False
Text10.Enabled = False
Text11.Enabled = False
DBteller.Enabled = False
DBrekening.Enabled = False
cmdhapus.Enabled = False
cmdsimpan.Enabled = False
cmdedit.Enabled = False
DBGrid1.Enabled = False
DBGrid2.Enabled = False
End Sub
Sub aktif()
Text1.Enabled = True
Text2.Enabled = True
Text3.Enabled = True
Text4.Enabled = True
Text5.Enabled = True
Text6.Enabled = True
Text7.Enabled = True
Text8.Enabled = True
Text10.Enabled = True
Text11.Enabled = True
DBteller.Enabled = True
DBrekening.Enabled = True
Call bersih
DBGrid1.Enabled = True
DBGrid2.Enabled = True
cmdhapus.Enabled = True
cmdsimpan.Enabled = True
End Sub
Sub bersih()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text10.Text = ""
Text11.Text = ""
DBteller.Text = ""
DBrekening.Text = ""
End Sub
Form Tarik
Private Sub DBGrid2_Click()
DBrekening.Text = Data1.Recordset!no_rekening
Text10.Text = Data1.Recordset!alamat
Text11.Text = Data1.Recordset!jenis_kelamin
Text5.Text = Data1.Recordset!nama_nasabah
Text8.Text = Data1.Recordset!saldo
End Sub
Private Sub cmdedit_Click()
Data3.Recordset.Edit
Data3.Recordset!no_penarikan = Text1.Text
Data3.Recordset!ID_teller = DBteller.Text
Data3.Recordset!no_rekening = DBrekening.Text
Data3.Recordset!tanggal_penarikan = Text3.Text
Data3.Recordset!jam_penarikan = Text4.Text
Data3.Recordset!jumlah_penarikan = "Rp." & Text7.Text
Data3.Recordset!saldo_akhir = "Rp." & Text8.Text
Data3.Recordset.Update
DBGrid1.Refresh
cmdedit.Enabled = False
End Sub
Private Sub cmdhapus_Click()
If MsgBox("yakin ingin menghapus data?", vbQuestion +
vbOKCancel, "konfirmasi") = vbOK Then
Data3.Recordset.Delete
cmdedit.Enabled = False
Me.Data3.Refresh
End If
End Sub
Private Sub cmdkeluar_Click()
X = MsgBox("Are You Sure To Quit?", vbQuestion + vbOKCancel,
"konfirmation")
If X = vbOK Then
Unload Me
End If
End Sub
Private Sub cmdok_Click()
Data1.Recordset.Edit
Data1.Recordset!no_rekening = DBrekening.Text
Data1.Recordset!nama_nasabah = Text5.Text
Data1.Recordset!jenis_kelamin = Text11.Text
Data1.Recordset!alamat = Text10.Text
Data1.Recordset!saldo = Text8.Text
Data1.Recordset.Update
DBGrid2.Refresh
End Sub
Private Sub cmdsimpan_Click()
Data3.Recordset.AddNew
Data3.Recordset!no_penarikan = Text1.Text
Data3.Recordset!ID_teller = DBteller.Text
Data3.Recordset!no_rekening = DBrekening.Text
Data3.Recordset!tanggal_penarikan = Text3.Text
Data3.Recordset!jam_penarikan = Text4.Text
Data3.Recordset!jumlah_penarikan = "Rp." & Text7.Text
Data3.Recordset!saldo_akhir = "Rp." & Text8.Text
Data3.Recordset.Update
DBGrid1.Refresh
Call bersih
cmdsimpan.Enabled = False
cmdtambah.Enabled = True
Call non_aktif
End Sub
Private Sub cmdtambah_Click()
Call aktif
cmdtambah.Enabled = False
cmdedit.Enabled = False
cmdhapus.Enabled = False
Text3.Text = Format(Date, "DD/MM/YYYY")
Text4.Text = Format(Now, "h:mm:ss")
Text1.SetFocus
End Sub
Private Sub DBGrid1_Click()
Text1.Text = Data3.Recordset!no_penarikan
DBteller.Text = Data3.Recordset!ID_teller
DBrekening.Text = Data3.Recordset!no_rekening
Text3.Text = Data3.Recordset!tanggal_penarikan
Text4.Text = Data3.Recordset!jam_penarikan
Text7.Text = Data3.Recordset!jumlah_penarikan
Text8.Text = Data3.Recordset!saldo_akhir
Text3.Enabled = False
Text4.Enabled = False
cmdedit.Enabled = True
cmdsimpan.Enabled = False
cmdtambah.Enabled = True
cmdhapus.Enabled = True
End Sub
Private Sub DBrekening_Change()
Data1.Recordset.Index = "no_rekening"
Data1.Recordset.Seek "=", DBrekening.Text
If Not Data1.Recordset.NoMatch Then
Text6.Text = Data1.Recordset!saldo
End If
End Sub
Private Sub DBteller_Change()
Data2.Recordset.Index = "ID_teller"
Data2.Recordset.Seek "=", DBteller.Text
If Not Data2.Recordset.NoMatch Then
Text2.Text = Data2.Recordset!nama_teller
End If
End Sub
Private Sub form_load()
Call non_aktif
End Sub
Private Sub Text7_Change()
Text8.Text = Val(Text6.Text) - Val(Text7.Text)
End Sub
Private Sub timer1_timer()
lblwaktu.Caption = Format(Now, "hh:mm:ss")
End Sub
Sub non_aktif()
Text1.Enabled = False
Text2.Enabled = False
Text3.Enabled = False
Text4.Enabled = False
Text5.Enabled = False
Text6.Enabled = False
Text7.Enabled = False
Text8.Enabled = False
Text10.Enabled = False
Text11.Enabled = False
DBteller.Enabled = False
DBrekening.Enabled = False
cmdhapus.Enabled = False
cmdsimpan.Enabled = False
cmdedit.Enabled = False
DBGrid1.Enabled = False
DBGrid2.Enabled = False
End Sub
Sub aktif()
Text1.Enabled = True
Text2.Enabled = True
Text3.Enabled = True
Text4.Enabled = True
Text5.Enabled = True
Text6.Enabled = True
Text7.Enabled = True
Text8.Enabled = True
DBteller.Enabled = True
DBrekening.Enabled = True
Call bersih
DBGrid1.Enabled = True
DBGrid2.Enabled = True
cmdhapus.Enabled = True
cmdsimpan.Enabled = True
End Sub
Sub bersih()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
DBteller.Text = ""
DBrekening.Text = ""
End Sub