Top Banner
VISUAL BASIC TUGAS UJIAN Disusun Oleh : Rahmadani 04.45011.01440.08 Jurusan : Ilmu Komputer 1
33
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Program Visual Basic Ktp

VISUAL BASICTUGAS UJIAN

Disusun Oleh :

Rahmadani04.45011.01440.08

Jurusan : Ilmu Komputer

FAKULTAS MATEMATIKA DAN ILMU PENGETAHUAN ALAM

UNIVERSITAS MULAWARMAN

SAMARINDA

1

Page 2: Program Visual Basic Ktp

2006DESAIN FORM

2

Page 3: Program Visual Basic Ktp

SETTING PROPERTY

Keterangan :

1. NIK

2. NAMA

3. Combosex

4. KELAHIRAN

5. MASKED TGL

3

1

2

6

4

5

3

7

89

1011

12

13

14

15

16

191817

Page 4: Program Visual Basic Ktp

6. ALAMAT

7. RTRW

8. KEL

9. KEC

10. KOTA

11. POS

12. AGAMA

13. Combonegara

14. PEKERJAAN

15. CombiSTATUS

16. ComboGODAR

17. simpan

18. batal

19. keluar

4

Page 5: Program Visual Basic Ktp

DAFTAR DATA

FORMS :

1. Edit Data

2. Hapus

3. Isi Data

4. Lihat Data

5. Lihat Data Satu

6. MDI Form

DESIGNERS :

1. Data Environment

2. Data Report

5

Page 6: Program Visual Basic Ktp

FORMS

1. Edit Data

Dim ktp As DatabaseDim datktp As Recordset

Private Sub batal_Click()NIK.Text = ""combonegara.Text = ""Combosex.Text = ""ComboSTATUS.Text = ""ComboGODAR.Text = ""MASKEDTGL.Mask = ""MASKEDTGL.Text = ""MASKEDTGL.Mask = "##/##/####"NAMA.Text = ""KELAHIRAN.Text = ""ALAMAT.Text = ""RTRW.Text = ""KEL.Text = ""KEC.Text = ""KOTA.Text = ""POS.Text = ""AGAMA.Text = ""PEKERJAAN.Text = ""End Sub

Private Sub Combosex_Click()KELAHIRAN.SetFocusEnd Sub

Private Sub Form_Activate()NIK.SetFocuscombonegara.AddItem "WNI"combonegara.AddItem "WNA"Combosex.AddItem "PRIA"Combosex.AddItem "WANITA"ComboSTATUS.AddItem "Belum Menikah"ComboSTATUS.AddItem "Menikah"ComboGODAR.AddItem "-"ComboGODAR.AddItem "A"ComboGODAR.AddItem "B"

6

Page 7: Program Visual Basic Ktp

ComboGODAR.AddItem "AB"ComboGODAR.AddItem "O"MASKEDTGL.Mask = "##/##/####"NAMA.Text = ""KELAHIRAN.Text = ""ALAMAT.Text = ""RTRW.Text = ""KEL.Text = ""KEC.Text = ""KOTA.Text = ""POS.Text = ""AGAMA.Text = ""combonegara.Text = ""PEKERJAAN.Text = ""End Sub

Private Sub Form_Load()Set ktp = OpenDatabase("D:\My Documents\ktp.mdb")Set datktp = ktp.OpenRecordset("DATA")datktp.Index = "IDXDAT"e = MsgBox("Untuk mengedit data, masukkan NIK data yang akan diedit lalu tekan enter", vbInformation, "PERINGATAN")End Sub

Private Sub Image2_Click()

End Sub

Private Sub keluar_Click()Unload MeEnd Sub

Private Sub NIK_KeyPress(KeyAscii As Integer)If KeyAscii = 13 Then datktp.Index = "idxdat" datktp.Seek "=", NIK.Text If Not datktp.NoMatch Then NIK.Text = datktp!NIK NAMA.Text = datktp!NAMA Combosex.Text = datktp!JEN_KEL KELAHIRAN.Text = datktp!KELAHIRAN MASKEDTGL.Text = datktp!TGL_LHR ALAMAT.Text = datktp!ALAMAT RTRW.Text = datktp!RTRW KEL.Text = datktp!KELURAHAN

7

Page 8: Program Visual Basic Ktp

KEC.Text = datktp!KECAMATAN KOTA.Text = datktp!KOTA POS.Text = datktp!KODEPOS AGAMA.Text = datktp!AGAMA combonegara.Text = datktp!KEWARGANEGARAAN PEKERJAAN.Text = datktp!PEKERJAAN ComboSTATUS.Text = datktp!PERKAWINAN ComboGODAR.Text = datktp!GODAR Else e = MsgBox("Data Yang Anda Cari Tidak Ada", vbInformation, "PERINGATAN")End IfEnd IfEnd SubPrivate Sub NAMA_KeyPress(KeyAscii As Integer)If KeyAscii = 13 Then Combosex.SetFocusEnd IfEnd SubPrivate Sub kelahiran_KeyPress(KeyAscii As Integer)If KeyAscii = 13 Then MASKEDTGL.SetFocusEnd IfEnd SubPrivate Sub maskedtgl_KeyPress(KeyAscii As Integer)If KeyAscii = 13 Then ALAMAT.SetFocusEnd IfEnd SubPrivate Sub alamat_KeyPress(KeyAscii As Integer)If KeyAscii = 13 Then RTRW.SetFocusEnd IfEnd SubPrivate Sub rtrw_KeyPress(KeyAscii As Integer)If KeyAscii = 13 Then KEL.SetFocusEnd IfEnd SubPrivate Sub kel_KeyPress(KeyAscii As Integer)If KeyAscii = 13 Then KEC.SetFocusEnd IfEnd SubPrivate Sub kec_KeyPress(KeyAscii As Integer)If KeyAscii = 13 Then

8

Page 9: Program Visual Basic Ktp

KOTA.SetFocusEnd IfEnd SubPrivate Sub kota_KeyPress(KeyAscii As Integer)If KeyAscii = 13 Then POS.SetFocusEnd IfEnd SubPrivate Sub pos_KeyPress(KeyAscii As Integer)If KeyAscii = 13 Then AGAMA.SetFocusEnd IfEnd SubPrivate Sub agama_KeyPress(KeyAscii As Integer)If KeyAscii = 13 Then combonegara.SetFocusEnd IfEnd SubPrivate Sub simpan_Click()If NIK.Text = "" Thene = MsgBox("Masukkan Data Anda Dengan Lengkap", vbInformation, "PERINGATAN") NIK.SetFocus Exit SubEnd IfIf NAMA.Text = "" Then e = MsgBox("Masukkan Data Anda Dengan Lengkap", vbInformation, "PERINGATAN") NAMA.SetFocus Exit SubEnd IfIf Combosex.Text = "" Then e = MsgBox("Masukkan Data Anda Dengan Lengkap", vbInformation, "PERINGATAN") Combosex.SetFocus Exit SubEnd IfIf KELAHIRAN.Text = "" Then e = MsgBox("Masukkan Data Anda Dengan Lengkap", vbInformation, "PERINGATAN") KELAHIRAN.SetFocus Exit SubEnd IfIf ALAMAT.Text = "" Then e = MsgBox("Masukkan Data Anda Dengan Lengkap", vbInformation, "PERINGATAN")

9

Page 10: Program Visual Basic Ktp

ALAMAT.SetFocus Exit SubEnd IfIf RTRW.Text = "" Then e = MsgBox("Masukkan Data Anda Dengan Lengkap", vbInformation, "PERINGATAN") RTRW.SetFocus Exit SubEnd IfIf KEL.Text = "" Then e = MsgBox("Masukkan Data Anda Dengan Lengkap", vbInformation, "PERINGATAN") KEL.SetFocus Exit SubEnd IfIf KEC.Text = "" Then e = MsgBox("Masukkan Data Anda Dengan Lengkap", vbInformation, "PERINGATAN") KEC.SetFocus Exit SubEnd IfIf KOTA.Text = "" Then e = MsgBox("Masukkan Data Anda Dengan Lengkap", vbInformation, "PERINGATAN") KOTA.SetFocus Exit SubEnd IfIf POS.Text = "" Then e = MsgBox("Masukkan Data Anda Dengan Lengkap", vbInformation, "PERINGATAN") POS.SetFocus Exit SubEnd IfIf AGAMA.Text = "" Then e = MsgBox("Masukkan Data Anda Dengan Lengkap", vbInformation, "PERINGATAN") AGAMA.SetFocus Exit SubEnd IfIf combonegara.Text = "" Then e = MsgBox("Masukkan Data Anda Dengan Lengkap", vbInformation, "PERINGATAN") combonegara.SetFocus Exit SubEnd IfIf PEKERJAAN.Text = "" Then

10

Page 11: Program Visual Basic Ktp

e = MsgBox("Masukkan Data Anda Dengan Lengkap", vbInformation, "PERINGATAN") PEKERJAAN.SetFocus Exit SubEnd IfIf ComboSTATUS.Text = "" Then e = MsgBox("Masukkan Data Anda Dengan Lengkap", vbInformation, "PERINGATAN") ComboSTATUS.SetFocus Exit SubEnd IfIf ComboGODAR.Text = "" Then e = MsgBox("Masukkan Data Anda Dengan Lengkap", vbInformation, "PERINGATAN") ComboGODAR.SetFocus Exit SubEnd IfWith datktp.Edit.Fields("NIK").Value = NIK.Text.Fields("NAMA").Value = NAMA.Text.Fields("JEN_KEL").Value = Combosex.Text.Fields("KELAHIRAN").Value = KELAHIRAN.Text.Fields("TGL_LHR").Value = CDate(MASKEDTGL.Text).Fields("ALAMAT").Value = ALAMAT.Text.Fields("RTRW").Value = RTRW.Text.Fields("KELURAHAN").Value = KEL.Text.Fields("KECAMATAN").Value = KEC.Text.Fields("KOTA").Value = KOTA.Text.Fields("KODEPOS").Value = POS.Text.Fields("AGAMA").Value = AGAMA.Text.Fields("KEWARGANEGARAAN").Value = combonegara.Text.Fields("PEKERJAAN").Value = PEKERJAAN.Text.Fields("PERKAWINAN").Value = ComboSTATUS.Text.Fields("GODAR").Value = ComboGODAR.Text.UpdateEnd WithNIK.Text = ""NIK.SetFocusCombosex.Text = ""ComboSTATUS.Text = ""ComboGODAR.Text = ""MASKEDTGL.Mask = ""MASKEDTGL.Text = ""MASKEDTGL.Mask = "##/##/####"NAMA.Text = ""

11

Page 12: Program Visual Basic Ktp

KELAHIRAN.Text = ""ALAMAT.Text = ""RTRW.Text = ""KEL.Text = ""KEC.Text = ""KOTA.Text = ""POS.Text = ""AGAMA.Text = ""combonegara.Text = ""PEKERJAAN.Text = ""End SubPrivate Sub combonegara_click() PEKERJAAN.SetFocusEnd SubPrivate Sub pekerjaan_KeyPress(KeyAscii As Integer)If KeyAscii = 13 Then ComboSTATUS.SetFocusEnd IfEnd SubPrivate Sub combostatus_click() ComboGODAR.SetFocusEnd SubPrivate Sub combogodar_click() simpan.SetFocusEnd Sub

12

Page 13: Program Visual Basic Ktp

2. Hapus

Dim ktp As DatabaseDim datktp As Recordset

Private Sub batal_Click()NIK.SetFocusNIK.Text = ""Combosex.Text = ""ComboSTATUS.Text = ""ComboGODAR.Text = ""MASKEDTGL.Mask = ""MASKEDTGL.Text = ""MASKEDTGL.Mask = "##/##/####"NAMA.Text = ""KELAHIRAN.Text = ""ALAMAT.Text = ""RTRW.Text = ""KEL.Text = ""KEC.Text = ""KOTA.Text = ""POS.Text = ""AGAMA.Text = ""combonegara.Text = ""PEKERJAAN.Text = ""End Sub

Private Sub Form_Activate()NIK.SetFocusEnd Sub

Private Sub Form_Load()Set ktp = OpenDatabase("D:\My Documents\ktp.mdb")Set datktp = ktp.OpenRecordset("DATA")datktp.Index = "IDXDAT"rizky = MsgBox("Untuk menghapus data, masukkan NIK data yang akan dihapus lalu tekan enter", vbInformation, "PERINGATAN")End Sub

Private Sub Hapus_Click()rizky = MsgBox("Anda Yakin Menghapus", vbYesNo + vbQuestion, "Peringatan")If rizky = 6 Then datktp.Delete

13

Page 14: Program Visual Basic Ktp

NIK.SetFocus NIK.Text = "" Combosex.Text = "" ComboSTATUS.Text = "" ComboGODAR.Text = "" MASKEDTGL.Mask = "" MASKEDTGL.Text = "" MASKEDTGL.Mask = "##/##/####" NAMA.Text = "" KELAHIRAN.Text = "" ALAMAT.Text = "" RTRW.Text = "" KEL.Text = "" KEC.Text = "" KOTA.Text = "" POS.Text = "" AGAMA.Text = "" combonegara.Text = "" PEKERJAAN.Text = ""Else NIK.Text = "" NIK.SetFocus Combosex.Text = "" ComboSTATUS.Text = "" ComboGODAR.Text = "" MASKEDTGL.Mask = "" MASKEDTGL.Text = "" MASKEDTGL.Mask = "##/##/####" NAMA.Text = "" KELAHIRAN.Text = "" ALAMAT.Text = "" RTRW.Text = "" KEL.Text = "" KEC.Text = "" KOTA.Text = "" POS.Text = "" AGAMA.Text = "" combonegara.Text = "" PEKERJAAN.Text = ""End IfEnd Sub

Private Sub Image2_Click()

End Sub

14

Page 15: Program Visual Basic Ktp

Private Sub keluar_Click()Unload MeEnd Sub

Private Sub Label5_Click()

End Sub

Private Sub NIK_KeyPress(KeyAscii As Integer)If KeyAscii = 13 Then datktp.Index = "idxdat" datktp.Seek "=", NIK.Text If Not datktp.NoMatch Then NIK.Text = datktp!NIK NAMA.Text = datktp!NAMA Combosex.Text = datktp!JEN_KEL KELAHIRAN.Text = datktp!KELAHIRAN MASKEDTGL.Text = datktp!TGL_LHR ALAMAT.Text = datktp!ALAMAT RTRW.Text = datktp!RTRW KEL.Text = datktp!KELURAHAN KEC.Text = datktp!KECAMATAN KOTA.Text = datktp!KOTA POS.Text = datktp!KODEPOS AGAMA.Text = datktp!AGAMA combonegara.Text = datktp!KEWARGANEGARAAN PEKERJAAN.Text = datktp!PEKERJAAN ComboSTATUS.Text = datktp!PERKAWINAN ComboGODAR.Text = datktp!GODAR Else e = MsgBox("Data Yang Anda Cari Tidak Ada", vbInformation, "PERINGATAN")End IfEnd IfEnd Sub

15

Page 16: Program Visual Basic Ktp

3. Isi Data

Dim ktp As DatabaseDim datktp As Recordset

Private Sub batal_Click()NIK.Text = ""Combosex.Text = ""ComboSTATUS.Text = ""ComboGODAR.Text = ""MASKEDTGL.Mask = ""MASKEDTGL.Text = ""MASKEDTGL.Mask = "##/##/####"NAMA.Text = ""KELAHIRAN.Text = ""ALAMAT.Text = ""RTRW.Text = ""KEL.Text = ""KEC.Text = ""KOTA.Text = ""POS.Text = ""AGAMA.Text = ""combonegara.Text = ""PEKERJAAN.Text = ""End Sub

Private Sub Combosex_Click()KELAHIRAN.SetFocusEnd Sub

Private Sub Form_Activate()NIK.SetFocuscombonegara.AddItem "WNI"combonegara.AddItem "WNA"Combosex.AddItem "PRIA"Combosex.AddItem "WANITA"ComboSTATUS.AddItem "Belum Menikah"ComboSTATUS.AddItem "Menikah"ComboGODAR.AddItem "-"ComboGODAR.AddItem "A"ComboGODAR.AddItem "B"ComboGODAR.AddItem "AB"ComboGODAR.AddItem "O"

16

Page 17: Program Visual Basic Ktp

MASKEDTGL.Mask = "##/##/####"NAMA.Text = ""KELAHIRAN.Text = ""ALAMAT.Text = ""RTRW.Text = ""KEL.Text = ""KEC.Text = ""KOTA.Text = ""POS.Text = ""AGAMA.Text = ""PEKERJAAN.Text = ""End Sub

Private Sub Form_Load()Set ktp = OpenDatabase("D:\My Documents\ktp.mdb")Set datktp = ktp.OpenRecordset("DATA")datktp.Index = "IDXDAT"End Sub

Private Sub Image2_Click()

End Sub

Private Sub keluar_Click()Unload MeEnd Sub

Private Sub NIK_KeyPress(KeyAscii As Integer)If KeyAscii = 13 Then NAMA.SetFocusEnd IfEnd SubPrivate Sub NAMA_KeyPress(KeyAscii As Integer)If KeyAscii = 13 Then Combosex.SetFocusEnd IfEnd SubPrivate Sub kelahiran_KeyPress(KeyAscii As Integer)If KeyAscii = 13 Then MASKEDTGL.SetFocusEnd IfEnd SubPrivate Sub maskedtgl_KeyPress(KeyAscii As Integer)If KeyAscii = 13 Then ALAMAT.SetFocusEnd If

17

Page 18: Program Visual Basic Ktp

End SubPrivate Sub alamat_KeyPress(KeyAscii As Integer)If KeyAscii = 13 Then RTRW.SetFocusEnd IfEnd SubPrivate Sub rtrw_KeyPress(KeyAscii As Integer)If KeyAscii = 13 Then KEL.SetFocusEnd IfEnd SubPrivate Sub kel_KeyPress(KeyAscii As Integer)If KeyAscii = 13 Then KEC.SetFocusEnd IfEnd SubPrivate Sub kec_KeyPress(KeyAscii As Integer)If KeyAscii = 13 Then KOTA.SetFocusEnd IfEnd SubPrivate Sub kota_KeyPress(KeyAscii As Integer)If KeyAscii = 13 Then POS.SetFocusEnd IfEnd SubPrivate Sub pos_KeyPress(KeyAscii As Integer)If KeyAscii = 13 Then AGAMA.SetFocusEnd IfEnd SubPrivate Sub agama_KeyPress(KeyAscii As Integer)If KeyAscii = 13 Then combonegara.SetFocusEnd IfEnd SubPrivate Sub simpan_Click()If NIK.Text = "" Thene = MsgBox("Masukkan Data Anda Dengan Lengkap", vbInformation, "PERINGATAN") NIK.SetFocus Exit SubEnd IfIf NAMA.Text = "" Then e = MsgBox("Masukkan Data Anda Dengan Lengkap", vbInformation, "PERINGATAN")

18

Page 19: Program Visual Basic Ktp

NAMA.SetFocus Exit SubEnd IfIf Combosex.Text = "" Then e = MsgBox("Masukkan Data Anda Dengan Lengkap", vbInformation, "PERINGATAN") Combosex.SetFocus Exit SubEnd IfIf KELAHIRAN.Text = "" Then e = MsgBox("Masukkan Data Anda Dengan Lengkap", vbInformation, "PERINGATAN") KELAHIRAN.SetFocus Exit SubEnd IfIf ALAMAT.Text = "" Then e = MsgBox("Masukkan Data Anda Dengan Lengkap", vbInformation, "PERINGATAN") ALAMAT.SetFocus Exit SubEnd IfIf RTRW.Text = "" Then e = MsgBox("Masukkan Data Anda Dengan Lengkap", vbInformation, "PERINGATAN") RTRW.SetFocus Exit SubEnd IfIf KEL.Text = "" Then e = MsgBox("Masukkan Data Anda Dengan Lengkap", vbInformation, "PERINGATAN") KEL.SetFocus Exit SubEnd IfIf KEC.Text = "" Then e = MsgBox("Masukkan Data Anda Dengan Lengkap", vbInformation, "PERINGATAN") KEC.SetFocus Exit SubEnd IfIf KOTA.Text = "" Then e = MsgBox("Masukkan Data Anda Dengan Lengkap", vbInformation, "PERINGATAN") KOTA.SetFocus Exit SubEnd IfIf POS.Text = "" Then

19

Page 20: Program Visual Basic Ktp

e = MsgBox("Masukkan Data Anda Dengan Lengkap", vbInformation, "PERINGATAN") POS.SetFocus Exit SubEnd IfIf AGAMA.Text = "" Then e = MsgBox("Masukkan Data Anda Dengan Lengkap", vbInformation, "PERINGATAN") AGAMA.SetFocus Exit SubEnd IfIf combonegara.Text = "" Then e = MsgBox("Masukkan Data Anda Dengan Lengkap", vbInformation, "PERINGATAN") combonegara.SetFocus Exit SubEnd IfIf PEKERJAAN.Text = "" Then e = MsgBox("Masukkan Data Anda Dengan Lengkap", vbInformation, "PERINGATAN") PEKERJAAN.SetFocus Exit SubEnd IfIf ComboSTATUS.Text = "" Then e = MsgBox("Masukkan Data Anda Dengan Lengkap", vbInformation, "PERINGATAN") ComboSTATUS.SetFocus Exit SubEnd IfIf ComboGODAR.Text = "" Then e = MsgBox("Masukkan Data Anda Dengan Lengkap", vbInformation, "PERINGATAN") ComboGODAR.SetFocus Exit SubEnd IfWith datktp.AddNew.Fields("NIK").Value = NIK.Text.Fields("NAMA").Value = NAMA.Text.Fields("JEN_KEL").Value = Combosex.Text.Fields("KELAHIRAN").Value = KELAHIRAN.Text.Fields("TGL_LHR").Value = CDate(MASKEDTGL.Text).Fields("ALAMAT").Value = ALAMAT.Text.Fields("RTRW").Value = RTRW.Text.Fields("KELURAHAN").Value = KEL.Text.Fields("KECAMATAN").Value = KEC.Text

20

Page 21: Program Visual Basic Ktp

.Fields("KOTA").Value = KOTA.Text

.Fields("KODEPOS").Value = POS.Text

.Fields("AGAMA").Value = AGAMA.Text

.Fields("KEWARGANEGARAAN").Value = combonegara.Text

.Fields("PEKERJAAN").Value = PEKERJAAN.Text

.Fields("PERKAWINAN").Value = ComboSTATUS.Text

.Fields("GODAR").Value = ComboGODAR.Text

.UpdateEnd WithNIK.Text = ""NIK.SetFocusCombosex.Text = ""ComboSTATUS.Text = ""ComboGODAR.Text = ""MASKEDTGL.Mask = ""MASKEDTGL.Text = ""MASKEDTGL.Mask = "##/##/####"NAMA.Text = ""KELAHIRAN.Text = ""ALAMAT.Text = ""RTRW.Text = ""KEL.Text = ""KEC.Text = ""KOTA.Text = ""POS.Text = ""AGAMA.Text = ""combonegara.Text = ""PEKERJAAN.Text = ""End SubPrivate Sub combonegara_click() PEKERJAAN.SetFocusEnd SubPrivate Sub pekerjaan_KeyPress(KeyAscii As Integer)If KeyAscii = 13 Then ComboSTATUS.SetFocusEnd IfEnd SubPrivate Sub combostatus_click() ComboGODAR.SetFocusEnd SubPrivate Sub combogodar_click() simpan.SetFocusEnd Sub

21

Page 22: Program Visual Basic Ktp

4. Lihat Data

Dim ktp As DatabaseDim datktp As Recordset

Private Sub cetak_Click()With datktp.OpenRecordsetPrinter.PrintQuality = -2Printer.FontSize = 10Printer.Print Tab(10); "N.I.K "; Tab(33); ":"; Tab(35); NIK.TextPrinter.Print Tab(10); "Nama "; Tab(33); ":"; Tab(35); NAMA.TextPrinter.Print Tab(10); "Jenis Kelamin "; Tab(33); ":"; Tab(35); Combosex.TextPrinter.Print Tab(10); "Kelahiran "; Tab(33); ":"; Tab(35); KELAHIRAN.Text; Tab(49); MASKEDTGL.TextPrinter.Print Tab(10); "Alamat "; Tab(33); ":"; Tab(35); ALAMAT.TextPrinter.Print Tab(20); "R.T / R.W "; Tab(40); ":"; Tab(42); RTRW.TextPrinter.Print Tab(20); "Kelurahan "; Tab(40); ":"; Tab(42); KEL.TextPrinter.Print Tab(20); "Kecamatan "; Tab(40); ":"; Tab(42); KEC.TextPrinter.Print Tab(20); "Kota "; Tab(40); ":"; Tab(42); KOTA.TextPrinter.Print Tab(20); "Kode POS "; Tab(40); ":"; Tab(42); POS.TextPrinter.Print Tab(10); "Agama "; Tab(33); ":"; Tab(35); AGAMA.TextPrinter.Print Tab(10); "Kewarganegaraan "; Tab(33); ":"; Tab(35); combonegara.TextPrinter.Print Tab(10); "Pekerjaan "; Tab(33); ":"; Tab(35); PEKERJAAN.TextPrinter.Print Tab(10); "Status Perkawinan "; Tab(33); ":"; Tab(35); ComboSTATUS.TextPrinter.Print Tab(10); "Golongan Darah "; Tab(33); ":"; Tab(35); ComboGODAR.TextEnd WithEnd Sub

Private Sub Form_Load()Set ktp = OpenDatabase("D:\My Documents\ktp.mdb")Set datktp = ktp.OpenRecordset("DATA")datktp.Index = "IDXDAT"End Sub

Private Sub keluar_Click()Unload Me

22

Page 23: Program Visual Basic Ktp

End Sub

5. Lihat Data Satu

Dim ktp As DatabaseDim datktp As Recordset

Private Sub cetak_Click()With datktp.OpenRecordsetPrinter.PrintQuality = -2Printer.FontSize = 10Printer.Print Tab(10); "N.I.K "; Tab(33); ":"; Tab(35); NIK.TextPrinter.Print Tab(10); "Nama "; Tab(33); ":"; Tab(35); NAMA.TextPrinter.Print Tab(10); "Jenis Kelamin "; Tab(33); ":"; Tab(35); Combosex.TextPrinter.Print Tab(10); "Kelahiran "; Tab(33); ":"; Tab(35); KELAHIRAN.Text; Tab(49); MASKEDTGL.TextPrinter.Print Tab(10); "Alamat "; Tab(33); ":"; Tab(35); ALAMAT.TextPrinter.Print Tab(20); "R.T / R.W "; Tab(40); ":"; Tab(42); RTRW.TextPrinter.Print Tab(20); "Kelurahan "; Tab(40); ":"; Tab(42); KEL.TextPrinter.Print Tab(20); "Kecamatan "; Tab(40); ":"; Tab(42); KEC.TextPrinter.Print Tab(20); "Kota "; Tab(40); ":"; Tab(42); KOTA.TextPrinter.Print Tab(20); "Kode POS "; Tab(40); ":"; Tab(42); POS.TextPrinter.Print Tab(10); "Agama "; Tab(33); ":"; Tab(35); AGAMA.TextPrinter.Print Tab(10); "Kewarganegaraan "; Tab(33); ":"; Tab(35); combonegara.TextPrinter.Print Tab(10); "Pekerjaan "; Tab(33); ":"; Tab(35); PEKERJAAN.TextPrinter.Print Tab(10); "Status Perkawinan "; Tab(33); ":"; Tab(35); ComboSTATUS.TextPrinter.Print Tab(10); "Golongan Darah "; Tab(33); ":"; Tab(35); ComboGODAR.TextEnd WithEnd Sub

Private Sub Form_Load()Set ktp = OpenDatabase("D:\My Documents\ktp.mdb")Set datktp = ktp.OpenRecordset("DATA")datktp.Index = "IDXDAT"End Sub

Private Sub keluar_Click()Unload Me

23

Page 24: Program Visual Basic Ktp

End Sub

6. MDI From

Private Sub mdata_Click()DataReport1.ShowUnload editdataUnload isidataUnload lihatdatasatuUnload DataReport1Unload lihatdataUnload HapusEnd Sub

Private Sub medit_Click()editdata.ShowUnload isidataUnload lihatdatasatuUnload DataReport1Unload lihatdataUnload HapusEnd Sub

Private Sub mhps_Click()Hapus.ShowUnload lihatdatasatuUnload DataReport1Unload lihatdataUnload editdataUnload isidata

24

Page 25: Program Visual Basic Ktp

End Sub

Private Sub misi_Click()isidata.ShowUnload lihatdatasatuUnload DataReport1Unload lihatdataUnload editdataUnload Hapus

End Sub

Private Sub mkel_Click()Unload MeEnd Sub

Private Sub mlapor_Click()DataReport1.ShowUnload isidataUnload lihatdatasatuUnload lihatdataUnload editdataUnload HapusEnd Sub

Private Sub msatu_Click()lihatdatasatu.ShowUnload isidataUnload DataReport1Unload lihatdataUnload editdataUnload HapusEnd Sub

Private Sub msemua_Click()lihatdata.ShowUnload isidataUnload lihatdatasatuUnload DataReport1Unload editdataUnload HapusEnd Sub

25

Page 26: Program Visual Basic Ktp

DESIGNERS

1. Data Environment

26

Page 27: Program Visual Basic Ktp

2. Data Report

27

Page 28: Program Visual Basic Ktp

28