Anda di halaman 1dari 60

# Masalah: Membuat Program Aplikasi Untuk mencari luas Persegi-panjang.

Algoritmanya:

1. Mulai
2. Buat Judul
3. Masukan Panjang
4. Masukan Lebar
5. Hitung luas = Panjang*Lebar
6. Tampilkan Luas
7. Selesai

## CommandButton: Tombol tempat membuat perintah-perintah (Program) dalam bahasa Basic

Program Kurs Valuta Asing Pertemuan Ke 2

Tampilannya:

Property Komponenya :

Programnya :

Dim A As Integer

## Private Sub Dollar_Click()

TextValuta.Visible = True
TextKonversi.Visible = True
Label9.Visible = True
Label10.Visible = True
Dollar.Visible = True
Yen.Visible = True
Sterling.Visible = True
TextValuta = ""
TextKonversi = ""
TextValuta.SetFocus
A=1
Label9.Caption = "Masukkan Nilai Dollar \$:"

End Sub

## Private Sub Yen_Click()

TextValuta.Visible = True
TextKonversi.Visible = True
Label9.Visible = True
Label10.Visible = True
Dollar.Visible = True
Yen.Visible = True
Sterling.Visible = True
TextValuta = ""
TextKonversi = ""
TextValuta.SetFocus
A=2
Label9.Caption = "Masukkan Nilai Yen:"

End Sub

## Private Sub Sterling_Click()

TextValuta.Visible = True
TextKonversi.Visible = True
Label9.Visible = True
Label10.Visible = True
Dollar.Visible = True
Yen.Visible = True
Sterling.Visible = True
TextValuta = ""
TextKonversi = ""
TextValuta.SetFocus
A=3
Label9.Caption = "Masukkan Nilai Pounsterling:"
End Sub

TextValuta = ""
Text2 = ""

End Sub

End
End Sub

## If A = 1 Then TextKonversi = TextValuta * 13000

If A = 2 Then TextKonversi = TextValuta * 1050
If A = 3 Then TextKonversi = TextValuta * 19900

End Sub
Project : Toko Komputer

Properties:
Objek Property Pengaturan
Form Name: Toko
Caption: Form Isian Pesanan Barang
Label 1 Align 2 Centre
Caption: Toko Komputer Almo Shop
Font: Time New Roman, Bold ,18
ForeColor: Biru Tua
Label 2 Caption: Pesanan Produk
Font: Time New Roman, Bold ,14
ForeClor: Biru Tua
Label 3 Caption: Periferal (Pilih Salah Satu) :
Font: Time New Roman, Bold ,12
ForeClor: Biru Tua
Frame1 Caption: Komputer (Pilih) :

## Frame2 Caption: Peralatan Kantor:

Option Caption: PC
Index: 0
Value: True
Option Caption: Macintosh
Index: 1

Index: 2

## Check3 Caption: Photo Copy

List
ComboBox Text: Metode Pembayaran

## Image1 Strech: True

Image2 Strech: True
Image3 Strech: True
Image4 Strech: True
Image5 Strech: True
Image6 Strech: True
Command1 Caption : &Keluar
Cari di dalam Komputer gambar tentang :
PC, Macintosh, Laptop, Mesin penjawab, Kalkulator, Photo Copy, Hard Disk, Printer, Parabol, Dollar,
Cek, Rupiah,
Programnya:

DirGbr = "F:\DataBelajar2015\2017\Vbasic\Vb3if_2017\Gambar\"

End Sub

## Private Sub Option_Click(Index As Integer)

DirGbr = "E:\Ridwan_4ia_Vb-2015\FileGambarTokoKomputer\"

Case 0
Case 1
Case 2
End Select

End Sub

## Private Sub Check1_Click()

DirGbr = "E:\Ridwan_4ia_Vb-2015\FileGambarTokoKomputer\"
If Check1.Value = 1 Then
Image2.Picture = LoadPicture(DirGbr + "mesin penjawab.jpg")
Image2.Visible = True
Else
Image2.Visible = False
End If

End Sub

## Private Sub Check2_Click()

DirGbr = "E:\Ridwan_4ia_Vb-2015\FileGambarTokoKomputer\"
If Check2.Value = 1 Then
Image4.Visible = True
Else
Image4.Visible = False
End If

End Sub

## Private Sub Check3_Click()

DirGbr = "E:\Ridwan_4ia_Vb-2015\FileGambarTokoKomputer\"
If Check3.Value = 1 Then
Image6.Visible = True
Else
Image6.Visible = False
End If

End Sub

## Private Sub List1_Click()

DirGbr = "E:\Ridwan_4ia_Vb-2015\FileGambarTokoKomputer\"

## Select Case List1.ListIndex

Case 0
Image3.Picture = LoadPicture(DirGbr + "Hard Disk.jpg")
Case 1
Case 2
End Select

End Sub

## Private Sub Combo1_Click()

DirGbr = "E:\Ridwan_4ia_Vb-2015\FileGambarTokoKomputer\"

Case 0
Case 1
Case 2
End Select

End Sub

## Private Sub Command1_Click()

Toko.Hide
End Sub

Hasil Pemerogramannya:
Project Kalkulator

## Objek Property Pengaturan

Form Name: Kalkulator
Caption: Kalkulator
Label 1 Name: Tampilan
Aligment 1 - Right Justify
BackColor Putih
BorderStyle 1 – Fixed Single
Caption: “”
Font: Time New Roman, Bold ,24
ForeColor: Biru Tua
Command Name: Angka
Caption: 1
Index: 1
Font: Time New Roman, Bold ,24

## Command Name: Angka

Caption: 2
Index: 2
Font: Time New Roman, Bold ,24
ForeClor: Biru Tua
Command Name: Angka
Caption: 3
Index: 3
Font: Time New Roman, Bold ,24
ForeClor: Biru Tua
Command Name: Angka
Caption: 4
Index: 4
Font: Time New Roman, Bold ,24
ForeClor: Biru Tua
Command Name: Angka
Caption: 5
Index: 5
Font: Time New Roman, Bold ,24
ForeClor: Biru Tua
Command Name: Angka
Caption: 6
Index: 6
Font: Time New Roman, Bold ,24
ForeClor: Biru Tua
Command Name: Angka
Caption: 7
Index: 7
Font: Time New Roman, Bold ,24
ForeClor: Biru Tua
Command Name: Angka
Caption: 8
Index: 8
Font: Time New Roman, Bold ,24
ForeClor: Biru Tua
Command Name: Angka
Caption: 9
Index: 9
Font: Time New Roman, Bold ,24
ForeClor: Biru Tua
Command Name: Angka
Caption: 0
Index: 0
Font: Time New Roman, Bold ,24
ForeClor: Biru Tua
Command Name: Hapus
Caption: C
Font: Time New Roman, Bold ,24
ForeClor: Biru Tua
Command Name: Desimal
Caption: .
Font: Time New Roman, Bold ,24
ForeClor: Biru Tua
Command Name: TambahKurang
Caption: +/-
Font: Time New Roman, Bold ,24
ForeClor: Biru Tua
Command Name: Satuper
Caption: 1/x
Font: Time New Roman, Bold ,24
ForeClor: Biru Tua
Command Name: Tambah
Caption: +
Font: Time New Roman, Bold ,24
ForeClor: Biru Tua
Command Name: Kurang
Caption: -
Font: Time New Roman, Bold ,24
ForeClor: Biru Tua
Command Name: Kali
Caption: X
Font: Time New Roman, Bold ,24
ForeClor: Biru Tua
Command Name: Bagi
Caption: :
Font: Time New Roman, Bold ,24
ForeClor: Biru Tua

Tampilanya:

Programnya:
Dim Operasi1, Operasi2 As Double
Dim Operator As String

## Private Sub Angka_Click(Index As Integer)

Tampilan.Caption = Tampilan.Caption + Angka(Index).Caption
End Sub

## Private Sub Hapus_Click(Index As Integer)

Tampilan.Caption = ""
End Sub

## Private Sub Desimal_Click(Index As Integer)

If InStr(Tampilan.Caption, ".") Then
Exit Sub
End If
Tampilan.Caption = Tampilan.Caption + "."
End Sub

## Private Sub TambahKurang_Click()

Tampilan.Caption = -Val(Tampilan.Caption)
End Sub

## Private Sub Tambah_Click()

Operator = "+"
Operasi1 = Val(Tampilan.Caption)
Tampilan.Caption = ""
End Sub

## Private Sub Kurang_Click()

Operator = "-"
Operasi1 = Val(Tampilan.Caption)
Tampilan.Caption = ""
End Sub

## Private Sub Kali_Click()

Operator = "*"
Operasi1 = Val(Tampilan.Caption)
Tampilan.Caption = ""
End Sub

## Private Sub Bagi_Click()

Operator = "/"
Operasi1 = Val(Tampilan.Caption)
Tampilan.Caption = ""
End Sub

## Private Sub SatuPer_Click()

If Val(Tampilan.Caption) <> 0 Then Tampilan.Caption = 1 / Val(Tampilan.Caption)
End Sub

Dim Hasil As Double
Operasi2 = Val(Tampilan.Caption)
If Operator = "+" Then Hasil = Operasi1 + Operasi2
If Operator = "-" Then Hasil = Operasi1 - Operasi2
If Operator = "*" Then Hasil = Operasi1 * Operasi2
If Operator = "/" Then Hasil = Operasi1 / Operasi2

Tampilan.Caption = Hasil
End Sub
Nama Project: ProfilMhs

Tampilanya:

Proprtinya:

## Objek Property Pengaturan

Form Name: FormProfille
Caption: Form Profille Mahasiswa
TextBox Name: TxtNama
Text:
Font: Time New Roman, Bold ,14
Label 1 Name: Nama
Caption: Nama :
Font: Time New Roman, Bold ,10
Label 2 Name: LblHari
Aligment: 2 - Center
BackColor: Putih
BorderStyle: 1 – Fixed Single
Caption: “”
Font: Time New Roman, Bold ,10
Hitam
Label 3 Name: LblBulan
Aligment 2 - Center
BackColor Putih
BorderStyle 1 – Fixed Single
Caption: “”
Font: Time New Roman, Bold ,10
Hitam
Label 4 Name: LblTahun
Aligment 2 - Center
BackColor Putih
BorderStyle 1 – Fixed Single
Caption: “”
Font: Time New Roman, Bold ,10
Hitam
VscrollBar1 Name VsbHari
Min 1
Max 31

## VscrollBar2 Name VsbBulan

Min 1
Max 12
VscrollBar3 Name VsbTahun
Min 1960
Max 2017
Frame1 Caption Jenis Kelamin :
Font Time New Roman, Bold ,10
Frame2 Tingkat :
Time New Roman, Bold ,10
Frame3 Tanggal Lahir :
Time New Roman, Bold ,10
Frame4 Gambar :
Time New Roman, Bold ,10
Command1 Name: Lihat
Caption: &Lihat Profil
Command2 Name: Baru
Caption: &Profil Baru
Command3 Name: Keluar
Caption: &Keluar
Command4 Name: Tampil
Caption: &Tampil Gambar
OptionButton Name: Seks
Caption: Laki-laki
Index: 0
OptionButton Name: Seks
Caption: Perempuan
Index: 1
OptionButton Name: Tingkat
Caption: Satu
Index: 0
OptionButton Name: Tingkat
Caption: Dua
Index: 1
OptionButton Name: Tingkat
Caption: Tiga
Index: 2
CommondDialog Name: Buka
Filter: JPeg(*.Jpg)|*.Jpg
Image Name: ImgMhs
Stretch: True

Tampilanya Akhirnya:
Programnya :

## Dim Bulan(12) As String

Dim JlhHari(12) As Integer
Dim PsnSeks, PsnTingkat As String

Bulan(1) = "Januari": JlhHari(1) = 31
Bulan(2) = "Februari": JlhHari(2) = 28
Bulan(3) = "Maret": JlhHari(3) = 31
Bulan(4) = "April": JlhHari(4) = 30
Bulan(5) = "Mei": JlhHari(5) = 31
Bulan(6) = "Juni": JlhHari(6) = 30
Bulan(7) = "Juli": JlhHari(7) = 31
Bulan(8) = "Agustus": JlhHari(8) = 31
Bulan(9) = "September": JlhHari(9) = 30
Bulan(10) = "Oktober": JlhHari(10) = 31
Bulan(11) = "Nopember": JlhHari(11) = 30
Bulan(12) = "Desember": JlhHari(12) = 31

LblHari.Caption = Str(VSbHari.Value)
LblBulan.Caption = Bulan(Str(VSbBulan.Value))
LblTahun.Caption = Str(VSbTahun.Value)

End Sub

## If VSbBulan.Value = 1 Or VSbBulan.Value = 3 Or VSbBulan.Value = 5 Or VSbBulan.Value = 7 Or

VSbBulan.Value = 8 Or VSbBulan.Value = 10 Or VSbBulan.Value = 12 Then VSbHari.Max =
31
If VSbBulan.Value = 2 Then VSbHari.Max = 28
If VSbBulan.Value = 4 Or VSbBulan.Value = 6 Or VSbBulan.Value = 9 Or VSbBulan.Value = 11
Then VSbHari.Max = 30

LblHari.Caption = Str(VSbHari.Value)
End Sub
Private Sub VSbBulan_Change()
LblBulan.Caption = Bulan(Str(VSbBulan.Value))
LblHari.Caption = Str(VSbHari.Min)
End Sub

## Private Sub VSbTahun_Change()

LblTahun.Caption = Str(VSbTahun.Value)
End Sub

## Private Sub Seks_Click(Index As Integer)

If Seks(0).Value = True Then PsnSeks = "Laki-Laki"
If Seks(1) Then PsnSeks = "Perempuan"
End Sub

## Private Sub Tingkat_Click(Index As Integer)

Select Case Index
Case 0
PsnTingkat = "Satu"
Case 1
PsnTingkat = ”Dua”
Case 2
PsnTingkat = "Tiga"
End Select

Atau

## If Tingkat(0) Then PsnTingkat = ", Satu"

If Tingkat(1) Then PsnTingkat = ", Dua"
If Tingkat(1) Then PsnTingkat = ", Tiga"
End Sub

## Dim Umur As Double

'Validasi Nama
If TxtNama.Text = "" Then
MsgBox "Nama Harus Diisi !", vbOKOnly, " Mohon Perhatian"
TxtNama.SetFocus
Exit Sub

End If

'Validasi Seks
If Seks(0).Value = False And Seks(1).Value = False Then

MsgBox "Jenis Kelamin Harus Diisi !", vbOKOnly, " Mohon Perhatian"

Exit Sub

End If

'Validasi Tingkat
If Tingkat(0).Value = False And Tingkat(1).Value = False And Tingkat(2).Value = False Then

Exit Sub

End If

## Umur = Format(Now, "yyyy") - Val(VSbTahun.Value)

Pesan = "Nama: " + TxtNama.Text + ", Jenis Kelamin: " + PsnSeks + ", Tingkat: " + PsnTingkat +
", Lahir Tanggal: " + LblHari + " " + LblBulan + LblTahun + ", Umur : " + Str(Umur) + " Tahun"

End Sub

## Private Sub Baru_Click()

TxtNama.Text = ""
Seks(0).Value = False
Seks(1).Value = False
Tingkat(0).Value = False
Tingkat(1).Value = False
Tingkat(2).Value = False

End Sub

Buka.ShowOpen
End Sub

## Private Sub Tingkat_Click(Index As Integer)

If Tingkat(0).Value = True Then PsnTingkat = Tingkat(0).Caption
If Tingkat(1).Value = True Then PsnTingkat = Tingkat(1).Caption
If Tingkat(2).Value = True Then PsnTingkat = Tingkat(2).Caption
End Sub

## Private Sub Lihat_Click()

Dim pesan As String

'VALIDASI NAMA
If Nama.Text = "" Then
MsgBox "Nama Harus Diisi..!", vbOKOnly, " Mohon Perhatian"
Nama.SetFocus
Exit Sub
End If

## 'VALIDASI JENIS KELAMIN

If Seks(0).Value = False And Seks(1).Value = False Then
MsgBox "Jenis Kelamin Harus Diisi..!", vbOKOnly, " Mohon Perhatian"
Exit Sub
End If

'VALIDASI TINGKAT
If Tingkat(0).Value = False And Tingkat(1).Value = False And Tingkat(2).Value = False Then
MsgBox "Tingkat Harus Diisi..!", vbOKOnly, " Mohon Perhatian"
Exit Sub
End If

pesan = "Nama : " + Nama.Text + ", Jenis Kelamin : " + PsnSeks + ", Tingkat : " + PsnTingkat +
", Lahir Tanggal: " + LblHari + " " + LblBulan + " " + LblTahun
MsgBox pesan, vbOK, "Profil Mahasiswa/i"
End Sub

## Private Sub Baru_Click()

Nama.Text = ""
Seks(0).Value = False
Seks(1).Value = False
Tingkat(0).Value = False
Tingkat(1).Value = False
Tingkat(2).Value = False
End Sub

Buka.ShowOpen
End Sub

FormProfil.Hide
End Sub

Basisdata

## Database(bahasa Inggris) atau dieja menjadi Basis-data a d a l a h kumpulan penjelasan

terstruktur (skema) dari jenis fakta yang tersimpan di dalamnya yang disimpan di dalam
komputer secara sistematik sehinggadapat diperiksa menggunakan suatu program komputer
untuk memperoleh informasi. Struktur (skema) menggambarkan obyek yang diwakili suatu basis
data, dan hubungan di antara obyek tersebut.

Nama Field

## NAMA GENDER GAJI

Record 1 JAMES C PRIA 4 200 000
Record 2 ALBERT K PRIA 4 795 000
File
Record 3 DORIS A WANITA 3 690 000
Record 4 HARRY M WANITA 4 900 000

Field

## Pengolahan data : Menghimpun, Mengurutkan, Menghitung, Membandingkan, Mengklasifikasikan,

Meringkas, menyimpulkan.

Hirarki/tingkat data:

1. Bit (Binary digit) adalah signal Listrk Nyala=1 atau Padam=0 {1=Positif(+), 0=Negatif(-)}
2. Byte (Character) Adalah kumpulan dari Bit, misal: 0101 1010 J
3. Field (Word) Adalah kumpulan dari Byte contoh: James Kelly, Pria, 4.200.000
4. Record Adalah kumpulan dari Field Lihat Gambar di atas
5. File Adalah kumpulan dari Record Misal Record 1, Record 2 danRecord n
6. Database System kumpulan dari File yang memiliki susunan, kriteria tertentu dan memiliki satu
atau lebih kunci filed yang sama.

Buka Projeck Baru nama: ProjectDatabase4ia dan Form baru Nama: FormDbase4ia
Properitinya

## Objek Property Pengaturan

Form Name: FormDbase4ia
Caption: Pengolahan Data kelas 4ia
Data Name Data4ia
Caption: Data Kelas 4 ia
Connect : Access
DataBaseName E:\Ridwan_4ia_Vb-
2015\BasisData\Datanyo\Dbase
4ia.mdb
RecordSource: Tabel4ia
Label 1 Name: Label1
Caption: Nama :
Font: Time New Roman, Bold ,10
Label 2 Name: Label2
Caption: Nim
Aligment 2 - Center
BackColor Putih
BorderSty 1 – Fixed Single
Font: Time New Roman, Bold ,10
Hitam
Label 3 Name: Label3
Caption: Alamat
Aligment 2 - Center
BackColor Putih
BorderStyle 1 – Fixed Single
Font: Time New Roman, Bold ,10
Hitam

## Text Name Nama

Text: “”
DataSoerce: Data4ia
DataField: Nama
Font: Time New Roman, Bold ,10
Text Name Nim
Text: “”
DataSoerce: Data4ia
DataField: Nim
Font:
Text Name Alamat
Text: “”
DataSoerce: Data4ia
DataField: Alamat
Font: Time New Roman, Bold ,10
Command1 Name: Maju
Caption: &Maju
Font: Time New Roman, Bold ,10
Command2 Name: Mundur
Caption: M&undur
Font: Time New Roman, Bold ,10
Command3 Name: Awal
Caption: &Awal
Font: Time New Roman, Bold ,10
Command4 Name: Akhir
Caption: A&khir
Font: Time New Roman, Bold ,10
Command5 Name: Tambah
Caption: &Tambah
Font: Time New Roman, Bold ,10
Command6 Name: Hapus
Caption: &Hapus
Font: Time New Roman, Bold ,10
Command7 Name: Exit
Caption: E&xit
Font: Time New Roman, Bold ,10

## Buat data base dengan bantuan Visual data manager:

2) Pilih Visual data manager

3) Pilih File

4) Klik New
5) Pilih Microsoft Access
6) Pilih Versi 7.0 MDB
7) Buat Database dengan nama File: Dbase4ia
8) Buat Tabel nama : Tabel4ia

## 9) Klik Kanan pada Properties

10) Pilih New Table
11) Ketik Nama Tabel : Tabel4id
Masukan Struktur tabel
Nama/text/12
Nim/text/12
Alamat/text/25

## 13) Klik Tombol Close

14) Klik Tombol Build The Table
16) Klik Open
18) Masukan data kedalam tabel, yaitu:
Nama Nim Alamat
A Nety H 061330800600 Jl Lunjuk Jaya 17 Plg
Aditya Z. P. 061330800601 Jl B Besar 426 Plg
Annisa P. 061330800602 Jl T Barangan 6A Plg

## 1.3.3. Perancangan Database Dan Struktur Tabel untuk ProjectPrgTpd

Buat data base dengan bantuan Visual data manager:

2) Pilih Visual data manager

3) Pilih File

4) Klik New
5) Pilih Microsoft Access
6) Pilih Versi 7.0 MDB
7) Buat Database dengan nama File: DbasePrgTrp
8) Buat Tabel nama : TabelKaryawan, dengan rancangan, sebagai berikut:

1. Tabel Karyawan

Tabel Karyawan berisi data karyawan, Antara lain; Nama Depan, Nama Belakang, Kode Area,
Nomor Telepon, Gender, Tanggal Lahir dan Gaji. Strukturnya adalah:

## No Nama Field Tipe Lebar Desimal

1 Nama_Depan Text 12
2 Nama_Belakang Text 10
3 Kode_Area Text 3
4 Nomor_Telepon Text 8
5 Gender Text 6
6 Tanggal_Lahir Text 10
7 Gaji Double - 0

## 1) Klik Kanan pada Properties

2) Pilih New Table
3) Ketik Nama Tabel : TabelKaryawan
Masukan Struktur tabel

## Bila struktur table sudah dimasukan, mak:

1) Klik Tombol Close
2) Klik Tombol Build The Table
4) Klik Open
6) Update
7) Dan seterusnya sampai record terakhir

## Lalu Masukkan data, dibawah ini:

No. Nama_ Nama_ Kode_ Nomor_ Gender Tanggal_ Gaji
Rec. Depan Belakang Area Telepon Lahir
1 James C Smith 206 123-4567 Pria 07/04/1960 2200000
2 Albert K Zeller 212 456-9801 Pria 09/20/1959 2790000
3 Doris A Gregory 503 204-8567 Wanita 07/04/1962 1690000
4 Harry M Nelson 315 576-0235 Pria 02/15/1958 2900000
5 Tina B Baker 415 576-6782 Wanita 10/12/1956 2590000
6 Mary W Thampson 213 432-6782 Wanita 06/18/1955 2450000
7 Kirk D Duff 618 625-7845 Pria 08/04/1961 1975000
8 Charles N Lee 216 456-9873 Pria 07/22/1964 1350000
9 Winston E Hanson 503 365-8512 Pria 05/14/1939 3490000
10 Thomas T Chopman 216 397-8482 Pria 12/24/1945 2895000

8) Klik Close

2. Tabel Pelanggan

Tabel Pelanggan berisi data Pelanggan, Antara lain; Nomor Pelanggan, Nama Pelanggan, Alamat,
Kota, Kode Provinsi, Kode Daerah, Kode Area, Nomor Telepon, Kredit Maksimum. Strukturnya adalah:

## No Nama Field Tipe Lebar Desimal

1 Nomor_Pelanggan Text 5
2 Nama_Pelanggan Text 20
3 Alamat Text 20
4 Kota Text 12
5 Kode_Provinsi Text 2
6 Kode_Zip Text 5
7 Kode_Area Text 3
8 Nomor_Telepon Text 8
9 Kredit_Maksimum Double 8 0
 Masukkan data, dibawah ini:

No. Nomor Nama_Pel Alamat Kota Kode_ Kode_ Kode Nomor_ Kredit_Ma
Rec. _Pengg nggan Provinsi Zip _Are Telepon ksimum
an a
SUPER 123 Main
1 10001 Portland OR 97201 503 224-6890 2500000
SOUNDS Steet
ABC TV. 3459 Fifth
2 10002 Portland OR 97203 503 246-5687 2000000
STORE Avenue
ACE
2345 Coluabia
3 10003 SUPERVISI Vacouver WA 98664 206 892-4569 1200000
St.
ON
DYNAVISI
13560 S.W.
4 10004 ON TV. Portland OR 97201 503 287-8754 2200000
Division
SHOP
TOWER
7865
5 10005 STEREO & Vancouver WA 98665 206 574-7893 1000000
Highway 99
TV
1245
REDDING
6 10006 Lakeview Redding CA 94313 432 877-6543 2000000
SUPER TV
Drive
NATIONA
4567 Oak
7 10007 L TV & Portland OR 97204 503 289-6832 2500000
Street
STEREO
SUPERIOR
5789 S.W.
8 10008 TV & Portland OR 97202 503 224-6541 500000
SOUND
ELECTRO 2568
9 10009 NIC MART Evergreen Vancouver WA 98662 503 256-4578 1500000
Blvd.
STEREO
12008 S.
10 10010 SUPER Portland OR 97206 503 224-7275 2000000
Division
STORE

3. Tabel Stok

Tabel Stok berisi data Stok barang dagangan, Antara lain; Nomor Stok, Nomor Model , Pabrik,
Opsi, Persedian dan Pesanan. Strukturnya adalah:
No Nama Field Tipe Lebar Desimal
1 Nomor_Stok Text 12
2 Nomor_Model Text 10
3 Pabrik Text 9
4 Opsi Text 25
5 Persedian Double 8 0
6 Pesanan Double 8 0

## No. Nomor_Stok Nomor_Model Fabrik Opsi Perse Pesa

Rec. dian nan
1 ST-01-19P-01 RCA-XA100 RCA Standard 5 2
Stereo, Wireless
2 ST-01-25C-02 RCA-XA200 RCA 10 5
Remote
3 ST-02-19P-01 ZENITH-19P ZENITH Standard. Portable 7 3
Standard, wire
4 ST-02-21C-02 ZENITH-21C ZENITH 3 2
Remote
Stereo, Wireless
5 ST-02-25C-03 ZENITH-25C ZENITH 5 5
Remote
6 ST-03-17P-01 SONY1700P SONY Standard 4 4
Stereo, Wireless
7 ST-03-26C-02 SONY2600XT SONY 5 5
Remote
PANASONI Monitor, Wireless
8 ST-03-19P-01 PANAV019PT 3 2
C Remote
PANASONI Monitor, Wireless
9 ST-03-25C-02 PANAV25CTX 4 5
C Remote
10 ST-04-19P-01 SANYO-19-P SANYO Standard 3 2
Table Model,
11 ST-04-19P-02 SANYO-21-C SANYO 5 4
Wire Remote
4. Tabel Ongkos

Tabel Ongkos berisi data Ongkos barang dagangan, Antara lain; Nomor Stok, Nomor Model Harga
Daftar, Biaya Pokok dan Ongkos Angkut. Strukturnya adalah:

## No Nama Field Tipe Lebar Desimal

1 Nomor_Stok Text 12
2 Nomor_Model Text 10
3 Harga_Daftar Double 8 0
4 Biaya_Pokok Double 8 0
5 Ongkos_Angkut Double 8 0

## No. Nomor_Stok Nomor_Model Harga_ Biaya_ Ongkos_

Rec. Daftar Pokok Angkut
1 ST-01-19P-01 RCA-XA100 349950 229500 259950
2 ST-01-25C-02 RCA-XA200 595000 389000 459000
3 ST-02-19P-01 ZENITH-19P 385000 255000 325000
4 ST-02-21C-02 ZENITH-21C 449950 339000 389500
5 ST-02-25C-03 ZENITH-25C 759950 589000 669500
6 ST-03-17P-01 SONY1700P 450950 330000 380500
7 ST-03-26C-02 SONY2600XT 1390950 850000 109500
8 ST-03-19P-01 PANAV019PT 579950 395000 425000
9 ST-03-25C-02 PANAV25CTX 1095950 795000 885000
10 ST-04-19P-01 SANYO-19-P 1369000 249000 319000
11 ST-04-19P-02 SANYO-21-C 525950 365000 425500

Buka Projeck Baru nama: ProjectBaseTpd dan Form baru Nama: FormKaryawan
Propertynya
Objek Property Pengaturan
Form Name: FormKaryawan
Caption: Pengolahan Data Karyawan
Data Name DataKaryawan
Caption: Data Karyawan
Connect : Access
DataBaseName G:\DataBelajar2015\4iaVB2016\
DbaseTpd-4ia-
2016\Dbasenyo\Dbase4ia.mdb
RecordSource: Karyawan
Label Name: Label1
Caption: Nama Depan :
BackColor Putih
BorderSty 1 – Fixed Single
Font: Time New Roman, Bold ,10
Hitam
Label Name: Label2
Caption: Nama Belakang :
BackColor Putih
BorderSty 1 – Fixed Single
Font: Time New Roman, Bold ,10
Hitam
Label Name: Label3
Caption: Kode Area :
Aligment
BackColor Putih
BorderStyle 1 – Fixed Single
Font: Time New Roman, Bold ,10
Hitam
Label Name: Label4
Caption: Namor Telepon:
BackColor Putih
BorderSty 1 – Fixed Single
Font: Time New Roman, Bold ,10
Hitam
Label Name: Label5
Caption: Gender :
BackColor Putih
BorderSty 1 – Fixed Single
Font: Time New Roman, Bold ,10
Hitam
Label Name: Label6
Caption: Tanggal Lahir :
BackColor Putih
BorderSty 1 – Fixed Single
Font: Time New Roman, Bold ,10
Hitam
Label Name: Label7
Caption: Gaji :
BackColor Putih
BorderSty 1 – Fixed Single
Font: Time New Roman, Bold ,10
Hitam
Text: “”
DataSoerce: DataKaryawan
Font: Time New Roman, Bold ,10
Text Name NamaBelakang
Text: “”
DataSoerce: DataKaryawan
DataField: NamaBelakang
Font:
Text Name KodeArea
Text: “”
DataSoerce: DataKaryawan
DataField: KodeArea
Font: Time New Roman, Bold ,10
CommandButton Name: Command1
Caption: &Sebelum
Font: Time New Roman, Bold ,10
CommandButton Name: Command2
Caption: S&esudah
Font: Time New Roman, Bold ,10
CommandButton Name: Command3
Caption: &Awal
Font: Time New Roman, Bold ,10
CommandButton Name: Command4
Caption: A&khir
Font: Time New Roman, Bold ,10
CommandButton Name: Command5
Caption: &Tambah
Font: Time New Roman, Bold ,10
CommandButton Name: Command6
Caption: &Hapus
Font: Time New Roman, Bold ,10
CommandButton Name: Command7
Caption: Ke&luar
Font: Time New Roman, Bold ,10

## Validasi Huruf Pada Text1 sampai Text7 untuk FormKaryawan:

Private Sub Text1_KeyPress(KeyAscii As Integer)
Dim Huruf As String
Huruf = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ., "
If KeyAscii > 26 Then
If InStr(Huruf, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
End If
End If

End Sub

## Private Sub Text2_KeyPress(KeyAscii As Integer)

Dim Huruf As String
Huruf = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ., "
If KeyAscii > 26 Then
If InStr(Huruf, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
End If
End If
End Sub

## Private Sub Text3_KeyPress(KeyAscii As Integer)

Dim Angka As String
Angka = "1234567890"
If KeyAscii > 26 Then
If InStr(Angka, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
End If
End If
End Sub

## Private Sub Text4_KeyPress(KeyAscii As Integer)

Dim Angka As String
Angka = "1234567890-"
If KeyAscii > 26 Then
If InStr(Angka, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
End If
End If
End Sub

Propertyanya

## Objek Property Pengaturan

Form Name: FormPelanggan
Caption: Pengolahan Data Pelanggan
Data Name DataKPelanggan
Caption: Data Pelanggan
Connect : Access
DataBaseName G:\DataBelajar2015\4iaVB2016\
DbaseTpd-4ia-2016\
Dbasenyo\Dbase4ia.mdb
RecordSource: Pelanggan
Label Name: Label1
Caption: Nomor Pelanggan :
Font: Time New Roman, Bold ,10
Label Name: Label2
Caption: Nama Pelanggan :
BackColor Putih
BorderSty 1 – Fixed Single
Font: Time New Roman, Bold ,10
Hitam
Label Name: Label3
Caption: Alamat :
BackColor Putih
BorderStyle 1 – Fixed Single
Font: Time New Roman, Bold ,10
Hitam
Label Name: Label5
Caption: Kota :
BackColor Putih
BorderSty 1 – Fixed Single
Font: Time New Roman, Bold ,10
Hitam
Label Name: Label5
Caption: Kode_Provinsi :
BackColor Putih
BorderSty 1 – Fixed Single
Font: Time New Roman, Bold ,10
Hitam
Label Name: Label6
Caption: Kode_Zip :
BackColor Putih
BorderSty 1 – Fixed Single
Font: Time New Roman, Bold ,10
Hitam
Label Name: Label7
Caption: Kode_Area :
BackColor Putih
BorderSty 1 – Fixed Single
Font: Time New Roman, Bold ,10
Hitam
Label Name: Label6
Caption: Nomor_Telepon :
BackColor Putih
BorderSty 1 – Fixed Single
Font: Time New Roman, Bold ,10
Hitam
Label Name: Label6
Caption: Kredit_Maksimum :
BackColor Putih
BorderSty 1 – Fixed Single
Font: Time New Roman, Bold ,10
Hitam
Text Name: Text 1
Text: “”
DataSoerce: DataPelanggan
DataField: Nomor_Pelanggan
Font: Time New Roman, Bold ,10
Text Name Text 2
Text: “”
DataSoerce: DataKaryawan
DataField: Nama_Pelanggan
Font:
Text Name Text 3
Text: “”
DataSoerce: DataPelanggan
DataField: Alamat
Font: Time New Roman, Bold ,10
Text Name Text 4
Text: “”
DataSoerce: DataPelanggan
DataField: Kota
Font: Time New Roman, Bold ,10
Text Name Text 3
Text: “”
DataSoerce: DataPelanggan
DataField: Kode_Provinsi
Font: Time New Roman, Bold ,10
Text Name Text 3
Text: “”
DataSoerce: DataPelanggan
DataField: Kode_Zip
Font: Time New Roman, Bold ,10
Text Name Text 3
Text: “”
DataSoerce: DataPelanggan
DataField: Kode_Area
Font: Time New Roman, Bold ,10
Text Name Text 3
Text: “”
DataSoerce: DataPelanggan
DataField: Nomor_Telepon
Font: Time New Roman, Bold ,10
Text Name Text 3
Text: “”
DataSoerce: DataPelanggan
DataField: Kredit_Maksimum
Font: Time New Roman, Bold ,10
CommandButton Name: Command1
Caption: &Sebelum
Font: Time New Roman, Bold ,10
CommandButton Name: Command2
Caption: S&esudah
Font: Time New Roman, Bold ,10
CommandButton Name: Command3
Caption: &Awal
Font: Time New Roman, Bold ,10
CommandButton Name: Command4
Caption: A&khir
Font: Time New Roman, Bold ,10
CommandButton Name: Command5
Caption: &Tambah
Font: Time New Roman, Bold ,10
CommandButton Name: Command6
Caption: &Hapus
Font: Time New Roman, Bold ,10
CommandButton Name: Command
Caption: Ke&luar
Font: Time New Roman, Bold ,10

## Private Sub Text1_KeyPress(KeyAscii As Integer)

Dim Angka As String
Angka = "1234567890"
If KeyAscii > 26 Then
If InStr(Angka, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
End If
End If

End Sub

## Private Sub Text2_KeyPress(KeyAscii As Integer)

Dim Huruf As String
Huruf = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ., "
If KeyAscii > 26 Then
If InStr(Huruf, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
End If
End If
End Sub

## Private Sub Text3_KeyPress(KeyAscii As Integer)

Dim Huruf As String
Huruf =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890-/,. "
If KeyAscii > 26 Then
If InStr(Huruf, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
End If
End If
End Sub

## Private Sub Text4_KeyPress(KeyAscii As Integer)

Dim Huruf As String
Huruf = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ. "
If KeyAscii > 26 Then
If InStr(Huruf, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
End If
End If
End Sub

## Private Sub Text5_KeyPress(KeyAscii As Integer)

Dim Angka As String
Angka = "1234567890"
If KeyAscii > 26 Then
If InStr(Angka, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
End If
End If

End Sub

## Private Sub Text6_KeyPress(KeyAscii As Integer)

Dim Angka As String
Angka = "1234567890"
If KeyAscii > 26 Then
If InStr(Angka, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
End If
End If
End Sub

## Private Sub Text7_KeyPress(KeyAscii As Integer)

Dim Angka As String
Angka = "1234567890"
If KeyAscii > 26 Then
If InStr(Angka, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
End If
End If
End Sub

## Private Sub Text8_KeyPress(KeyAscii As Integer)

Dim Angka As String
Angka = "1234567890-"
If KeyAscii > 26 Then
If InStr(Angka, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
End If
End If
End Sub

## Private Sub Text9_KeyPress(KeyAscii As Integer)

Dim Angka As String
Angka = "1234567890"
If KeyAscii > 26 Then
If InStr(Angka, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
End If
End If

Propertyanya

## Objek Property Pengaturan

Form Name: FormStok
Caption: Pengolahan Data Persediaan
Data Name DataStok
Caption: Data Stok
Connect : Access
DataBaseName G:\DataBelajar2015\4iaVB2016\
DbaseTpd-4ia-2016\
Dbasenyo\Dbase4ia.mdb
RecordSource: Stok
Label Name: Label1
Caption: Nomor Stok :
Font: Time New Roman, Bold ,10
Label Name: Label2
Caption: Nomor_Model :
BackColor Putih
BorderSty 1 – Fixed Single
Font: Time New Roman, Bold ,10
Hitam
Label Name: Label3
Caption: Pabrik
BackColor Putih
BorderStyle 1 – Fixed Single
Font: Time New Roman, Bold ,10
Hitam
Label Name: Label4
Caption: Opsi :
BackColor Putih
BorderSty 1 – Fixed Single
Font: Time New Roman, Bold ,10
Hitam
Label Name: Label5
Caption: Persedian :
BackColor Putih
BorderSty 1 – Fixed Single
Font: Time New Roman, Bold ,10
Hitam
Label Name: Label6
Caption: Pesanan :
BackColor Putih
BorderSty 1 – Fixed Single
Font: Time New Roman, Bold ,10
Hitam
Text1 Name:
Text:
DataSoerce:
DataField:
Font:
Text2 Name:
Text:
DataSoerce:
DataField:
Font:
Text3 Name:
Text:
DataSoerce:
DataField:
Font:
Text4 Name:
Text:
DataSoerce:
DataField:
Font:
Text5 Name:
Text:
DataSoerce:
DataField:
Font:
Text6 Name:
Text:
DataSoerce:
DataField:
Font:
CommandButton Name: Command1
Caption: &Sebelum
Font: Time New Roman, Bold ,10
CommandButton Name: Command2
Caption: S&esudah
Font: Time New Roman, Bold ,10
CommandButton Name: Command3
Caption: &Awal
Font: Time New Roman, Bold ,10
CommandButton Name: Command4
Caption: A&khir
Font: Time New Roman, Bold ,10
CommandButton Name: Command5
Caption: &Tambah
Font: Time New Roman, Bold ,10
CommandButton Name: Command6
Caption: &Hapus
Font: Time New Roman, Bold ,10
CommandButton Name: Command
Caption: Ke&luar
Font: Time New Roman, Bold ,10

Command Button

## Validasi Huruf Pada Text1 sampai Text6 untuk FormStok:

Private Sub Text1_KeyPress(KeyAscii As Integer)
Dim HurufAngka As String
HurufAngka =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890-"
If KeyAscii > 26 Then
If InStr(HurufAngka, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
End If
End If

End Sub

## Private Sub Text2_KeyPress(KeyAscii As Integer)

Dim HurufAngka As String
HurufAngka="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ12345
67890-"
If KeyAscii > 26 Then
If InStr(HurufAngka, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
End If
End If
End Sub

## Private Sub Text3_KeyPress(KeyAscii As Integer)

Dim Huruf As String
Huruf="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
If KeyAscii > 26 Then
If InStr(Huruf, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
End If
End If
End Sub

## Private Sub Text4_KeyPress(KeyAscii As Integer)

Dim Huruf As String
Huruf= "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ,”
If KeyAscii > 26 Then
If InStr(Huruf, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
End If
End If
End Sub

## Private Sub Text5_KeyPress(KeyAscii As Integer)

Dim Angka As String
Angka = "1234567890"
If KeyAscii > 26 Then
If InStr(Angka, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
End If
End If

End Sub

## Private Sub Text6_KeyPress(KeyAscii As Integer)

Dim Angka As String
Angka = "1234567890"
If KeyAscii > 26 Then
If InStr(Angka, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
End If
End If
End Sub

Propertyanya

## Objek Property Pengaturan

Form Name: FormOngkos
Caption: Pengolahan Data Ongkos
Data Name DataOngkos
Caption: Data Ongkos
Connect : Access
DataBaseName G:\DataBelajar2015\4iaVB2016\
DbaseTpd-4ia-2016\
Dbasenyo\Dbase4ia.mdb
RecordSource: TabelOngkos
Label Name: Label1
Caption: Nomor Stok :
Font: Time New Roman, Bold ,10
Label Name: Label2
Caption: Nomor_Model :
BackColor Putih
BorderSty 1 – Fixed Single
Font: Time New Roman, Bold ,10
Hitam
Label Name: Label3
Caption: Harga Daftar :
BackColor Putih
BorderStyle 1 – Fixed Single
Font: Time New Roman, Bold ,10
Hitam
Label Name: Label4
Caption: Biaya_Pokok :
BackColor Putih
BorderSty 1 – Fixed Single
Font: Time New Roman, Bold ,10
Hitam
Label Name: Label5
Caption: Ongkos_Angkut :
BackColor Putih
BorderSty 1 – Fixed Single
Font: Time New Roman, Bold ,10
Hitam
CommandButton Name: Command1
Caption: &Sebelum
Font: Time New Roman, Bold ,10
CommandButton Name: Command2
Caption: S&esudah
Font: Time New Roman, Bold ,10
CommandButton Name: Command3
Caption: &Awal
Font: Time New Roman, Bold ,10
CommandButton Name: Command4
Caption: A&khir
Font: Time New Roman, Bold ,10
CommandButton Name: Command5
Caption: &Tambah
Font: Time New Roman, Bold ,10
CommandButton Name: Command6
Caption: &Hapus
Font: Time New Roman, Bold ,10
Text
Text
Text
Text
Text
Text
CommandButton Name: Command
Caption: Ke&luar
Font: Time New Roman, Bold ,10

## Private Sub Text1_KeyPress(KeyAscii As Integer)

Dim HurufAngka As String
Huruf Angka= "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890-"
If KeyAscii > 26 Then
If InStr(HurufAngka, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
End If
End If

End Sub

## Private Sub Text2_KeyPress(KeyAscii As Integer)

Dim HurufAngka As String
HurufAngka="ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890-"
If KeyAscii > 26 Then
If InStr(HurufAngka, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
End If
End If
End Sub

## Private Sub Text3_KeyPress(KeyAscii As Integer)

Dim Angka As String
Angka = "1234567890"
If KeyAscii > 26 Then
If InStr(Angka, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
End If
End If
End Sub
Private Sub Text4_KeyPress(KeyAscii As Integer)
Dim Angka As String
Angka = "1234567890"
If KeyAscii > 26 Then
If InStr(Angka, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
End If
End If
End Sub

## Private Sub Text5_KeyPress(KeyAscii As Integer)

Dim Angka As String
Angka = "1234567890"
If KeyAscii > 26 Then
If InStr(Angka, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
End If
End If

End Sub

## Buat Form dengan Nama FormMenu:

Buka Projek Properti :
Lalu Tekan OK

Menyusun Report
Klik tombol ellipsis
Cari database (mdb) file

Test Hubungan

Ok dan ok lagi

## Rename Ganti Nama menjadi: ConnectionKaryawan

Pilih Properties
Cammand Name : CommandKaryawan
Connection : ConnectionKaryawan
Database Object : Table
ObjectName: Karyawan

Lalu Ok
Buat reportnya:

## Atur Properties Report sbb:

1. Buka jendela Project
2. Klik kanan Pada DataReport Karyawan
3. Ubah/ketik, antara lain:
Name : DataReportKayawan
Caption :Data Laporan Karyawan
DataSource :DataEnvironment1
DataMember :CommandKaryawan

1. Klik Kanan Pada Area Report Design
2. Pilih Insert Control
3. Pilih Label

## 4. Ubah/ketik Properties, antara lain:

Name : Label1
Caption: Laporan Data Karyawan
Font : Areal : Bold : 20
ForeColor: Biru

## Detail dan Page Header Ditarik dari Tampilan DataInveronment1-ConectionKaryawan Masing:

Filed-fieldNya ke baris dibawah Detail
Pisahkan Field name nya Ke Page Header dan Field tetap di Detail, susun membentuk tabel