LAMPIRAN LIST PROGRAM

Similar documents
LAMPIRAN : LISTING PROGRAM

LAMPIRAN. Universitas Sumatera Utara

LAMPIRAN A LISTING PROGRAM. Universitas Sumatera Utara

LISTING PROGRAM. 1. Form Menu Utama. Universitas Sumatera Utara

Tutorial, Source code, Request Program Visual Basic

LAMPIRAN A : LISTING PROGRAM

End Sub. Sub Kunci() Dim i As Integer For i = 0 To 4 Txtfield(i).Locked = True Next i grddatagrid.enabled = False End Sub

L A M P I R A N. Universitas Sumatera Utara

LISTING PROGRAM. 1. Form Login. Private Sub BATAL_Click() End End Sub

An InputBox( ) function will display an input Box window where the user can enter a value or a text. The format is

LAMPIRAN FORM 1 Universitas Sumatera Universitas Utara

LISTING PROGRAM. Form Splash

LAMPIRAN. Universitas Sumatera Utara

LAMPIRAN 1. Kode Program Splash Screen

LAMPIRAN A : LISTING PROGRAM

1. Menu Utama. Private Sub abt_click() frmabout.show End Sub. Private Sub dafabsenhar_click() frmdafabsensihar.show End Sub

Understanding the MsgBox command in Visual Basic

LISTING PROGRAM. 1. Menu Utama

LAMPIRAN. Universitas Sumatera Utara

Nilai Input (Peringkat Alternatif Fuzzy dan Crisp Terhadap Kriteria)

LISTING PROGRAM. 1. Menu Utama

ต วอย างการสร างฟอร ม เมน การใช งาน

LISTING PROGRAM. Source Code Tampilan Awal. Source Code Menu Utama

LAMPIRAN A: Listing Program

Excel & Visual Basic for Applications (VBA)

KARTU BIMBINGAN TUGAS AKHIR MAHASISWA PEMBAHASAN PADA ASISTENSI MENGENAI, PADA BAB

LISTING PROGRAM. PrivateSub KeluarToolStripMenuItem_Click(sender AsObject, e AsEventArgs) Handles KeluarToolStripMenuItem.Click Close() EndSub

On Railway Reservation. U G D C A Semester VI. Roll No DA

Programming Concepts and Skills. Arrays continued and Functions

6/14/2010. VBA program units: Subroutines and Functions. Functions: Examples: Examples:

Lookup Project. frmlookup (Name: object is a combo box, style 2); use 4 labels: 2 for phone, 2 for mail. MsgBox Function:

SURAT KETERANGAN Hasil Uji Program Tugas Akhir

Rooftop Industries Pvt. Ltd.

Programming with visual Basic:

LAMPIRAN A PROGRAM ADMINISTRASI

Financial Functions (all with subtypes: Normal, Stairs, Points, Height, Hollow, Colors, Marks, No Border except where indicated):

Manual Pengguna. PCN Online Service Fulfillment System

EMPLOYEE PAYROLL SYSTEM

LAMPIRAN. Universitas Sumatera Utara

A Back-End Link Checker for Your Access Database

Visitor Management System

variables programming statements

TABLE OF CONTENTS ADVANCED VISUAL BASIC

Pengguna akan diberikan Username dan Password oleh Administrator untuk login sebagai admin/conference Manager bagi conference yang akan diadakan.

Visual Programming 1. What is Visual Basic? 2. What are different Editions available in VB? 3. List the various features of VB

Universitas Sumatera Utara

Private Sub Command2_Click() End End Sub. Private Sub Command3_Click() frmchangepassword.show End Sub. Private Sub Form_Activate() check_db End Sub

L A M P I R A N. Universitas Sumatera Utara

Visual Basic ,

IFA/QFN VBA Tutorial Notes prepared by Keith Wong

LAMPIRAN Lampiran Utama. a. Struktur Organisasi

AIM To analyze, design and develop code for Online Course Reservation System using Rational Rose software

Visual Basic , ,. Caption Hello, On Off. * + +, -. 1-Arrow, , 2- Cross. - project1.vbp, 4-form1.frm.

22. VB Programming Fundamentals Data Access with Data Objects

How-To Guide. SigIDp (With Microsoft Access) Demo. Copyright Topaz Systems Inc. All rights reserved.

Pengenalan Sistem Maklumat Dalam Pendidikan

Visual Basic ,

Revisions: jee Initial jee SW Version 1.1 now includes the leave type Other

ONLINE RAILWAY RESERVATION SYSTEM

MgtOp 470 Business Modeling with Spreadsheets Sample Midterm Exam. 1. Spreadsheets are known as the of business analysis.

MICROSOFT EXCEL. Membina Hamparan Elektronik Fungsi Hamparan Elektronik

Cara Login Ke CPanel Hosting.

Testing. ASP.NET MVC 2 Visual Studio Music Store

PANDUAN PENGGUNA (SUPPLIER) MAINTAIN CERTIFICATES/SUPPLIER DETAILS SUPPLIER RELATIONSHIP MANAGEMENT SUPPLY CHAIN MANAGEMENT SYSTEM (SCMS)

LAMPIRAN A-2 : LAPORAN PENJUALAN DOKUMEN KELUARAN

REGISTRATION GUIDE MCIS CUSTOMER PORTAL. Page 1

Lab Manual Visual Basic 6.0

Function: function procedures and sub procedures share the same characteristics, with

Registration of Supplier (ROS) TM Supplier Registration Renewal via SUS Portal (Pembaharuan Pendaftaran Pembekal TM melalui SUS Portal)

VBA. VBA at a glance. Lecture 61

PROGRAM BASCOM AVR. ' inisialisasi '

MICROSOFT EXCEL 2000 LEVEL 5 VBA PROGRAMMING INTRODUCTION

Propose a mathematical formula to verify the authenticity of any product of the integers using a scale (9) and verified using computer

Creating Macros David Giusto, Technical Services Specialist, Synergy Resources

VBA Macro for Micro Focus Reflections Face-to-Face Orlando March 2018

TEKNOLOGI, GADJET & KEIBUBAPAAN

Please answer questions in the space provided. Question point values are shown in parentheses.

Definition, Investigation and Analysis

MANAGE COURSE RESOURCES LABEL TEXT PAGE URL BOOK FILE FOLDER IMS CONTENT PACKAGE

L A M P I R A N. Universitas Sumatera Utara

Sub clear() lblidver.text = Nothing lblstatus.text = Nothing

Cara Install Windows 7 Service Pack 1 Offline

W97_Bablas_AC. Attribute VB_Name = "Module1" 'Attribute VB_Name = "DJOK" 'Creative design by me, dj ->

Design of Remote Health Monitoring System Client

PANDUAN PENGGUNA (SUPPLIER) MAINTAIN CERTIFICATES/SUPPLIER DETAILS SUPPLIER RELATIONSHIP MANAGEMENT SUPPLY CHAIN MANAGEMENT SYSTEM (SCMS)

DAFTAR PUSTAKA. Bojic, Paul, 2008, Business Information System. Pearson Education Ltd., England

The design and implementation of UML-based students information management system

PANDUAN PENGGUNA (PENSYARAH)

Password Protect an Access Database

L A M P I R A N. Universitas Sumatera Utara

JABATAN KIMIA Kategori Arahan Kerja

Respond to Data Entry Events

Registration of Supplier (ROS) TM Supplier Registration Renewal via SUS Portal (Pembaharuan Pendaftaran Pembekal TM melalui SUS Portal)

Control Properties. Example: Program to change background color

Leveraging MapInfo ProViewer with Microsoft Visual Basic to provide company-wide access to spatial data resources.

Universitas Sumatera Utara

Create a Login System in Visual Basic. Creating a login system. Start a new visual basic Windows Forms application project. Call it Login System

Information Security Management System ISO/IEC 27001:2013

ICT SPM 2011 SUGGESTION ANSWER. Section A

M2U MANUAL PENGGUNA USER MANUAL M2UNHJ. 0 P a g e BAHAGIAN SIMPANAN DAN PENGELUARAN JABATAN KHIDMAT PENDEPOSIT DAN OPERASI LEMBAGA TABUNG HAJI

Transcription:

LAMPIRAN LIST PROGRAM 1. Modules Public conn As New ADODB.Connection Public rstb_pendekatan As ADODB.Recordset Public rstb_solusi As ADODB.Recordset Public rstb_alasan As ADODB.Recordset Public rstb_pilihan As ADODB.Recordset Public rstb_user As ADODB.Recordset Public Sub konek_db() On Error GoTo konekerr If conn.state = 1 Then conn.close Set conn = New ADODB.Connection Set rstb_pendekatan = New ADODB.Recordset Set rstb_solusi = New ADODB.Recordset Set rstb_alasan = New ADODB.Recordset Set rstb_piliham = New ADODB.Recordset Set rstb_user = New ADODB.Recordset conn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + App.Path + "\hukumfiqih.mdb;persist Security Info=False" Exit Sub konekerr: MsgBox "Terdapat kesalahan! " & Err.Description, vbcritical, "Peringatan" Public Sub diskonek_db() conn.close 2. Form Admin

Public baru As Boolean Dim rspilih As ADODB.Recordset Private Sub cboedit_click() If cboedit.text = "Pilihan" Then frmtambahpilihan.show vbmodal frmsolusi.show vbmodal Me.Hide Private Sub cmdbatal_click() KunciTeks True tombolawal True Adodc1.Recordset.Cancel KosongkanForm Private Sub cmdhapus_click() On Error GoTo hapuserr Dim pil pil = MsgBox("Apakah anda yakin data ini akan dihapus?", vbquestion + vbyesno + vbdefaultbutton2, "Konfirmasi") If pil = vbyes Then Adodc1.Recordset.Delete Adodc1.Recordset.MoveLast MsgBox "Data Berhasil Dihapus!", vbinformation, "Informasi" Exit Sub hapuserr: MsgBox "Terdapat kesalahan! " & Err.Description, vbcritical, "Peringatan"

Private Sub cmdkeluar_click() Me.Hide Private Sub cmdrefresh_click() DataGrid1.Refresh Private Sub cmdsimpan_click() konek_db On Error GoTo simpanerr Dim rscek As ADODB.Recordset If txtidpendekatan.text = "" Or txtidpilihan.text = "" Or txtpertanyaan.text = "" Then MsgBox "Informasi belum lengkap! Lengkapi terlebih dahulu!", vbexclamation, "Peringatan" txtidpendekatan.setfocus Set rscek = New ADODB.Recordset rscek.open "select * from tb_pendekatan where Id_pendekatan='" & txtidpendekatan.text & "'", conn, 1, 2 If Not rscek.eof And baru Then MsgBox "Data dengan kode " & txtidpendekatan.text & " sudah ada, silahkan ganti dengan kode yang lain!", vbexclamation, "Peringatan" txtidpendekatan.setfocus: SendKeys "{HOME}+{END}" With Adodc1.Recordset Set rstb_pendekatan = New ADODB.Recordset rstb_pendekatan.open "insert into tb_pendekatan values ('" & txtidpendekatan.text & "', '" & txtpertanyaan.text & "', '" & txtfya.text & "', '" & cboya.text & "', '" & txtidpilihan.text & "')", conn, 1, 2 If rstb_pendekatan.bof Then.AddNew

.Update MsgBox "Data berhasil disimpan!", vbinformation, "Informasi" KunciTeks True tombolawal True KosongkanForm End With Exit Sub diskonek_db simpanerr: MsgBox "Terdapat kesalahan! " & Err.Description, vbcritical, "Peringatan" Private Sub cmdtambah_click() baru = True KunciTeks False tombolawal False txtidpendekatan.setfocus Sub tombolawal(kunci As Boolean) cmdtambah.enabled = kunci cmdsimpan.enabled = Not kunci cmdbatal.enabled = Not kunci cmdubah.enabled = kunci cmdhapus.enabled = kunci cmdkeluar.enabled = kunci Private Sub cmdubah_click() On Error GoTo ubaherr KunciTeks False

tombolawal False With Adodc1.Recordset Set rstb_pendekatan = New ADODB.Recordset rstb_pendekatan.open "select *from tb_pendekatan", conn, 1, 2 txtidpendekatan.text = rstb_pendekatan!id_pendekatan txtidpilihan.text = rstb_pendekatan!id_pilihan txtpertanyaan.text = rstb_pendekatan!pertanyaan txtfya.text = rstb_pendekatan!faktaya cboya.text = rstb_pendekatan!ya End With txtidpendekatan.setfocus baru = False Exit Sub ubaherr: MsgBox "Terdapat kesalahan! " & Err.Description, vbcritical, "Peringatan" Private Sub form_load() KunciTeks True tombolawal True Adodc1.ConnectionString = conn.connectionstring Adodc1.RecordSource = "select * from tb_pendekatan" 'Adodc1.Refresh Set DataGrid1.DataSource = Adodc1 DataGrid1.Columns(0).Width = 400 cboedit.additem "Solusi" cboedit.additem "Pilihan"

Sub KosongkanForm() txtidpendekatan.text = " " txtidpilihan.text = Empty txtpertanyaan.text = Empty txtfya.text = Empty cboya.text = Empty Sub KunciTeks(kunci As Boolean) txtidpendekatan.locked = kunci txtpertanyaan.locked = kunci txtfya.locked = kunci cboya.locked = kunci 3. Form Alasan Private Sub Command1_Click() End Sub tampil() konek_db LabelAlas.Caption = "" Set rstb_alasan = New ADODB.Recordset rstb_alasan.open "select *from tb_alasan", conn, 1, 2 rstb_alasan.movefirst Select Case frmpilihan.cbopilih.listindex Case 0 rstb_alasan.find "Id_alasan='A1'" LabelAlas.Caption = rstb_alasan!alasan Case 1

rstb_alasan.find "Id_alasan='A2'" LabelAlas.Caption = rstb_alasan!alasan Case 2 rstb_alasan.find "Id_alasan='A3'" LabelAlas.Caption = rstb_alasan!alasan Case 3 rstb_alasan.find "Id_alasan='A4'" LabelAlas.Caption = rstb_alasan!alasan Case 4 rstb_alasan.find "Id_alasan='A5'" LabelAlas.Caption = rstb_alasan!alasan Case 5 rstb_alasan.find "Id_alasan='A6'" LabelAlas.Caption = rstb_alasan!alasan Case 6 rstb_alasan.find "Id_alasan='A7'" LabelAlas.Caption = rstb_alasan!alasan Case 7 rstb_alasan.find "Id_alasan='A8'" LabelAlas.Caption = rstb_alasan!alasan End Select Private Sub form_load() tampil 4. Form Hasil Pendekatan Private Sub cmdalasan_click() frmalasan.show vbmodal Private Sub cmdsiap_click()

Me.Hide frmpendekatan.hide frmpilihan.hide Private Sub form_load() tampil Sub tampil() konek_db Set rstb_pendekatan = New ADODB.Recordset rstb_pendekatan.open "select *from tb_pendekatan", conn, 1, 2 rstb_pendekatan.movefirst Select Case frmpilihan.cbopilih.listindex Case 0 rstb_pendekatan.find "Id_pendekatan='PD1'" Labelhasil.Caption = rstb_pendekatan!faktaya Case 1 rstb_pendekatan.find "Id_pendekatan='PD4'" Labelhasil.Caption = rstb_pendekatan!faktaya Case 2 rstb_pendekatan.find "Id_pendekatan='PD7'" Labelhasil.Caption = rstb_pendekatan!faktaya Case 3 rstb_pendekatan.find "Id_pendekatan='PD10'" Labelhasil.Caption = rstb_pendekatan!faktaya Case 4 rstb_pendekatan.find "Id_pendekatan='PD13'" Labelhasil.Caption = rstb_pendekatan!faktaya Case 5 rstb_pendekatan.find "Id_pendekatan='PD14'"

Labelhasil.Caption = rstb_pendekatan!faktaya Case 6 rstb_pendekatan.find "Id_pendekatan='PD15'" Labelhasil.Caption = rstb_pendekatan!faktaya Case 7 rstb_pendekatan.find "Id_pendekatan='PD18'" Labelhasil.Caption = rstb_pendekatan!faktaya End Select rstb_pendekatan.close diskonek_db 5. Form Login Private Sub cmdkeluar_click() Unload Me Private Sub cmdmasuk_click() On Error GoTo login_err If cbolevel.text = "Pengguna" Then txtuser = "Pengguna" frmpilihan.show vbmodal Unload Me Exit Sub Set rstb_user = New ADODB.Recordset rstb_user.open "select *from tb_user where " & "username='" & txtuser.text & "' and " & "password='" & txtpass.text & "'", conn, 1, 2 If Not rstb_user.eof Then MsgBox "login berhasil" frmadmin.show vbmodal Unload Me

MsgBox "login gagal" rstb_user.close login_err: MsgBox Err.Description Private Sub form_load() cbolevel.additem "Administrator" cbolevel.additem "Pengguna" 6. Form Me Private Sub Command1_Click() Unload Me 7. Form Pendekatan Private Sub cmdselesai_click() Unload Me Private Sub cmdya_click() On Error Resume Next Set rstb_pertanyaan = New ADODB.Recordset If cbopilihpertanyaan = "" Then MsgBox "Maaf, Anda harus memilih kategori Permasalahan", vbokcancel, "Peringatan" cbopilihpertanyaan.text = rstb_pertanyaan Set rstb_alasan = New ADODB.Recordset rstb_alasan.addnew

rstb_alasan!id_alasan = rstb_pendekatan!id_pendekatan rstb_alasan!alasan = rstb_pendekatan!faktaya rstb_pendekatan.update jwb = rstb_pendekatan!ya If Left(jwb, 1) = "T" Then rstb_pendekatan.movefirst rstb_pendekatan.find " Id_pendekatan= '" & jwb & "' " Label1.Caption = rstb_pendekatan!pertanyaan rstb_solusi.movefirst rstb_solusi.find " Id_solusi= '" & jwb & "' " frmhasilpendekatan.label1.caption = rstb_solusi!solusi frmhasilpendekatan.show vbmodal Private Sub Label1_Click() Label1.Caption = cbopilihpertanyaan.text Private Sub cmdtidak_click() Label1.Caption = "" cbopilihpertanyaan.text = "" cbopilihpertanyaan.setfocus Private Sub form_load() tampil Sub tampil() konek_db

cbopilihpertanyaan.clear Set rstb_pendekatan = New ADODB.Recordset rstb_pendekatan.open "select *from tb_pendekatan", conn, 1, 2 rstb_pendekatan.movefirst Select Case frmpilihan.cbopilih.listindex Case 0 rstb_pendekatan.find "Id_pendekatan='PD1'" cbopilihpertanyaan.text = rstb_pendekatan!pertanyaan Case 1 rstb_pendekatan.find "Id_pendekatan='PD4'" cbopilihpertanyaan.text = rstb_pendekatan!pertanyaan Case 2 rstb_pendekatan.find "Id_pendekatan='PD8'" cbopilihpertanyaan.text = rstb_pendekatan!pertanyaan Case 3 rstb_pendekatan.find "Id_pendekatan='PD12'" cbopilihpertanyaan.text = rstb_pendekatan!pertanyaan Case 4 rstb_pendekatan.find "Id_pendekatan='PD13'" cbopilihpertanyaan.text = rstb_pendekatan!pertanyaan Case 5 rstb_pendekatan.find "Id_pendekatan='PD14'" cbopilihpertanyaan.text = rstb_pendekatan!pertanyaan Case 6 rstb_pendekatan.find "Id_pendekatan='PD15'" cbopilihpertanyaan.text = rstb_pendekatan!pertanyaan Case 7 rstb_pendekatan.find "Id_pendekatan='PD18'" cbopilihpertanyaan.text = rstb_pendekatan!pertanyaan End Select rstb_pendekatan.close

diskonek_db 8. Form Pilihan Private Sub cmdpilih_click() If cbopilih.text = " " Then MsgBox "Pilihan Kategori permasalahan tidak boleh kosong.", vbcritical + vbokonly, "Peringatan" frmpendekatan.show vbmodal Sub tampil() konek_db Dim i As Integer i = 0 cbopilih.clear Set rstb_pilihan = New ADODB.Recordset rstb_pilihan.open "select *from tb_pilihan", conn, 1, 2 rstb_pilihan.movefirst While Not rstb_pilihan.eof cbopilih.additem rstb_pilihan!pilihan, i i = i + 1 rstb_pilihan.movenext Wend diskonek_db cmdpilih.enabled = True Private Sub form_load() tampil

Private Sub Command2_Click() cbopilih.text = " " cbopilih.setfocus Private Sub Command3_Click() Unload Me 9. Form ProgramIni Private Sub Command1_Click() Unload Me 10. Form Solusi Public baru As Boolean Dim rspilih As ADODB.Recordset Private Sub cmdbatal_click() KunciTeks True tombolawal True Adodc1.Recordset.Cancel KosongkanForm Private Sub cmdhapus_click() On Error GoTo hapuserr Dim pil pil = MsgBox("Apakah anda yakin data ini akan dihapus?", vbquestion + vbyesno + vbdefaultbutton2, "Konfirmasi") If pil = vbyes Then Adodc1.Recordset.Delete Adodc1.Recordset.MoveLast MsgBox "Data Berhasil Dihapus!", vbinformation, "Informasi"

Exit Sub hapuserr: MsgBox "Terdapat kesalahan! " & Err.Description, vbcritical, "Peringatan" Private Sub cmdkeluar_click() Me.Hide Private Sub cmdsimpan_click() konek_db On Error GoTo simpanerr Dim rscek As ADODB.Recordset If txtidsolusi.text = "" Or txtsolusi.text = "" Then MsgBox "Informasi belum lengkap! Lengkapi terlebih dahulu!", vbexclamation, "Peringatan" txtidsolusi.setfocus Set rscek = New ADODB.Recordset rscek.open "select * from tb_solusi where Id_solusi='" & txtidsolusi.text & "'", conn, 1, 2 If Not rscek.eof And baru Then MsgBox "Solusi dengan kode " & txtidsolusi.text & " sudah ada, silahkan ganti dengan kode yang lain!", vbexclamation, "Peringatan" txtidsolusi.setfocus: SendKeys "{HOME}+{END}" With Adodc1.Recordset Set rstb_solusi = New ADODB.Recordset rstb_solusi.open "insert into tb_solusi values ('" & txtidsolusi.text & "', '" & txtsolusi.text & "')", conn, 1, 2 If rstb_solusi.bof Then.AddNew.Update

MsgBox "Data berhasil disimpan!", vbinformation, "Informasi" KunciTeks True tombolawal True KosongkanForm End With Exit Sub diskonek_db simpanerr: MsgBox "Terdapat kesalahan! " & Err.Description, vbcritical, "Peringatan" Private Sub cmdtambah_click() baru = True KunciTeks False tombolawal False txtidsolusi.setfocus Sub tombolawal(kunci As Boolean) cmdtambah.enabled = kunci cmdsimpan.enabled = Not kunci cmdbatal.enabled = Not kunci cmdubah.enabled = kunci cmdhapus.enabled = kunci cmdkeluar.enabled = kunci Private Sub cmdubah_click() On Error GoTo ubaherr KunciTeks False tombolawal False

With Adodc1.Recordset Set rstb_solusi = New ADODB.Recordset rstb_solusi.open "select *from tb_solusi", conn, 1, 2 txtidsolusi.text = rstb_solusi!id_solusi txtsolusi.text = rstb_solusi!solusi End With txtidsolusi.setfocus baru = False Exit Sub ubaherr: MsgBox "Terdapat kesalahan! " & Err.Description, vbcritical, "Peringatan" Private Sub form_load() KunciTeks True tombolawal True Adodc1.ConnectionString = conn.connectionstring Adodc1.RecordSource = "select * from tb_solusi" Set DataGrid1.DataSource = Adodc1 DataGrid1.Columns(0).Width = 400 Sub KosongkanForm() txtidsolusi.text = " " txtsolusi.text = "" Sub KunciTeks(kunci As Boolean) txtidsolusi.locked = kunci txtsolusi.locked = kunci

11. Form Tambah Pilihan Public baru As Boolean Dim rspilih As ADODB.Recordset Private Sub cmdbatal_click() KunciTeks True tombolawal True Adodc1.Recordset.Cancel KosongkanForm Private Sub cmdhapus_click() On Error GoTo hapuserr Dim pil pil = MsgBox("Apakah anda yakin data ini akan dihapus?", vbquestion + vbyesno + vbdefaultbutton2, "Konfirmasi") If pil = vbyes Then Adodc1.Recordset.Delete Adodc1.Recordset.MoveLast MsgBox "Data Berhasil Dihapus!", vbinformation, "Informasi" Exit Sub hapuserr: MsgBox "Terdapat kesalahan! " & Err.Description, vbcritical, "Peringatan" Private Sub cmdkeluar_click() Me.Hide Private Sub cmdsimpan_click() konek_db On Error GoTo simpanerr Dim rscek As ADODB.Recordset

If txtidpilihan.text = "" Or txtpilihan.text = "" Then MsgBox "Informasi belum lengkap! Lengkapi terlebih dahulu!", vbexclamation, "Peringatan" txtidpilihan.setfocus Set rscek = New ADODB.Recordset rscek.open "select * from tb_pilihan where Id_pilihan='" & txtidpilihan.text & "'", conn, 1, 2 If Not rscek.eof And baru Then MsgBox "Data dengan kode " & txtidsolusi.text & " sudah ada, silahkan ganti dengan kode yang lain!", vbexclamation, "Peringatan" txtidpilihan.setfocus: SendKeys "{HOME}+{END}" With Adodc1.Recordset Set rstb_pilihan = New ADODB.Recordset rstb_pilihan.open "insert into tb_pilihan values ('" & txtidpilihan.text & "', '" & txtpilihan.text & "')", conn, 1, 2 If rstb_pilihan.bof Then.AddNew.Update MsgBox "Data berhasil disimpan!", vbinformation, "Informasi" KunciTeks True tombolawal True KosongkanForm End With Exit Sub diskonek_db simpanerr: MsgBox "Terdapat kesalahan! " & Err.Description, vbcritical, "Peringatan"

Private Sub cmdtambah_click() baru = True KunciTeks False tombolawal False txtidpilihan.setfocus Sub tombolawal(kunci As Boolean) cmdtambah.enabled = kunci cmdsimpan.enabled = Not kunci cmdbatal.enabled = Not kunci cmdubah.enabled = kunci cmdhapus.enabled = kunci cmdkeluar.enabled = kunci Private Sub cmdubah_click() On Error GoTo ubaherr KunciTeks False tombolawal False With Adodc1.Recordset Set rstb_pilihan = New ADODB.Recordset rstb_pilihan.open "select *from tb_pilihan", conn, 1, 2 txtidpilihan.text = rstb_pilihan!id_pilihan txtpilihan.text = rstb_pilihan!pilihan End With txtidpilihan.setfocus baru = False Exit Sub ubaherr:

MsgBox "Terdapat kesalahan! " & Err.Description, vbcritical, "Peringatan" Private Sub form_load() KunciTeks True tombolawal True Adodc1.ConnectionString = conn.connectionstring Adodc1.RecordSource = "select * from tb_pilihan" Set DataGrid1.DataSource = Adodc1 DataGrid1.Columns(0).Width = 400 Sub KosongkanForm() txtidpilihan.text = " " txtpilihan.text = "" Sub KunciTeks(kunci As Boolean) txtidpilihan.locked = kunci txtpilihan.locked = kunci 12. Form Utama Private Sub close_click() Dim pesan pesan = MsgBox("Anda yakin mau keluar dari program?", vbquestion + vbyesno + vbdefaultbutton2, "Konfirmasi") If pesan = vbyes Then Unload Me

Private Sub cmdlogin_click() Dim pesan pesan = MsgBox("Selamat Datang, Silakan Login", vbyes, "Konfirmasi") frmlogin.show vbmodal Private Sub cmdme_click() frmme.show vbmodal Private Sub edda_click() frmlogin.show vbmodal Private Sub form_load() konek_db Private Sub form_activate() Call form_load Private Sub Form_Unload(Cancel As Integer) diskonek_db Unload Me End Private Sub mati_click() Dim pesan pesan = MsgBox("Anda yakin mau Log-Off dari sistem?", vbquestion + vbyesno + vbdefaultbutton2, "Konfirmasi") If pesan = vbyes Then frmlogin.show Me.Hide

Private Sub me_click() frmprogramini.show vbmodal Private Sub saya_click() frmme.show vbmodal