• Tidak ada hasil yang ditemukan

BAB V PENUTUP

5.4. Saran

Dengan memperhatikan kelebihan dan kekurangan pada SPPK Untuk

Menentukan Penjurusan Siswa SMA ini, maka dengan ini penulis menganjurkan

beberapa saran, yaitu :

a. SPPK ini dikembangkan menjadi lebih luas lagi dengan menyertakan sistem

kenaikan kelas.

b. SPPK ini dikembangkan menjadi lebih luas lagi dengan menambahkan

komponen manajemen pengetahuan (Knowledge Management).

c. Karena SPPK ini bersifat multi user, maka sistem ini dapat implementasikan

langsung pada jaringan komputer.

DAFTAR PUSTAKA

Dwi Prasetyo, Didik. 2003. Belajar Sendiri Administrasi Database Server

MySQL. Jakarta : PT Elex Media Komputindo Kelompok Gramedia.

Efraim, Turban. 1995. Decision Support System and Expert Systems. New Jersey:

Prentice Hall.

Hadi, Rahadian. 2004. Membuat Laporan dengan Crystal Report 8.5 dan Visual

Basic 6.0. Jakarta : PT Elex Media Komputindo Kelompok Gramedia.

Jogiyanto. 2005. Analisis dan Disain Sistem Informasi. Yogyakarta : Andi Offset.

Laudon, Kenneth C. and Jane P. Laudon. 2000. Management Information

System:Organization and Technology in The Nerworked Enterprise.

Prentice Hall.

Mc. Fadden, Fred R. and Jeffrey A. Hoffer. 1994. Modern Database

Management. Benjamin/Cummings Publising Company, Inc.

Ramadhan, Arief. 2004. Seri Penuntun Praktis Microsoft Visual Basic 6. Jakarta :

PT Elex Media Komputindo Kelompok Gramedia.

Sanjaya, Ridwan dan Onno W Purbo. 2002. Seri Penuntun Praktis MySQL dan

Koneksi Data Melalui Visual Basic. Jakarta : PT Elex Media Komputindo

Kelompok Gramedia.

Saputro, Haris. 2003. Manajemen Database MySQL Menggunakan MySQL Front.

Jakarta : PT Elex Media Komputindo Kelompok Gramedia.

Sentonius, Jemmy. 2005. Menguasai Pembuatan Laporan dengan Crystal Report

dalam 24 Jam. Yogyakarta : Andi Offset.

Suryo Kusumo, Aryo. 2004. Buku Latihan Pemrograman Database Dengan

Visual Basic 6.0. Jakarta : PT Elex Media Komputindo Kelompok

Gramedia.

LISTING PROGRAM

Proses Penentuan Jurusan

Dim i, jipa, jips, jbhs As Integer Dim jur As String

Private Sub Akd_Click() AcnAkademik

Frame3.Caption = "PENJURUSAN ACUAN AKADEMIK" Akd.Checked = True

Pil.Checked = False Khs.Checked = False End Sub

Private Sub Pil_Click() AcnPilihan

Frame3.Caption = "PENJURUSAN ACUAN PILIHAN" Akd.Checked = False

Pil.Checked = True Khs.Checked = False End Sub

Private Sub Khs_Click() AcnKhusus

Frame3.Caption = "PENJURUSAN ACUAN KHUSUS" Akd.Checked = False

Pil.Checked = False Khs.Checked = True End Sub

Private Sub Exit_Click() Unload Me

End Sub

Private Sub Procen_Layout(Dftr As ListView, sub_It As Integer) Dim a, s, HS, Tot As Integer

Dim p_A, p_S, p_HS As Double Shape1.Visible = True Shape2.Visible = True Shape3.Visible = True a = 0: s = 0: HS = 0 With Dftr For i = 1 To .ListItems.Count

If .ListItems(i).SubItems(sub_It) = "IPA" Then a = a + 1

ElseIf .ListItems(i).SubItems(sub_It) = "IPS" Then s = s + 1

ElseIf .ListItems(i).SubItems(sub_It) = "BHS" Then HS = HS + 1 End If Next i txtFields(0) = a txtFields(1) = s txtFields(2) = HS Tot = a + s + HS txtFields(3) = Tot

If a <> 0 Then p_A = a / Tot Else p_A = 0 If s <> 0 Then p_S = s / Tot Else p_S = 0 If HS <> 0 Then p_HS = HS / Tot Else p_HS = 0

Shape1.Width = p_A * 6735

'Shape2.Left = (Shape1.Left + Shape1.Width) Shape2.Width = p_S * 6735

'Shape3.Left = (Shape2.Left + Shape2.Width) Shape3.Width = p_HS * 6735

End With End Sub 'Akademik

Private Function Akademik_Output(nis As String) As String Dim acuan As String

Dim max, hasil, nipa, nips, nbhs As Double

MySQL = "select * from raport where kodeMtp like '%A1%' and nis='" & nis & "'" EKSEKUSI

nipa = 0

Do While myRecordset.EOF = False

nipa = nipa + (myRecordset!nilai) / 2 myRecordset.MoveNext

Loop

nipa = nipa / 4

MySQL = "select * from raport where kodeMtp like '%A2%' and nis='" & nis & "'" EKSEKUSI

nips = 0

Do While myRecordset.EOF = False

nips = nips + (myRecordset!nilai) / 2 myRecordset.MoveNext

Loop

nips = nips / 4

MySQL = "select * from raport where kodeMtp like '%A3%' and nis='" & nis & "'" EKSEKUSI

nbhs = 0

Do While myRecordset.EOF = False

nbhs = nbhs + (myRecordset!nilai) / 2 myRecordset.MoveNext

Loop

nbhs = nbhs / 2 If nipa > nips Then max = nipa If max > nbhs Then hasil = max jur = "IPA" jipa = 0 jipa = jipa + 1 Else If max < nbhs Then hasil = nbhs jur = "BHS" jbhs = 0 jbhs = jbhs + 1 Else If max = nbhs Then hasil = max jur = "IPA" jipa = 0 jipa = jipa + 1 End If End If End If Else

If nipa < nips Then max = nips If max > nbhs Then hasil = max jur = "IPS" jips = 0 jips = jips + 1 Else If max < nbhs Then hasil = nbhs jur = "BHS" jbhs = 0 jbhs = jbhs + 1 Else If max = nbhs Then hasil = max jur = "IPS" jips = 0 jips = jips + 1 End If End If End If

Else

If nipa = nips Then max = nipa If max > nbhs Then hasil = max jur = "IPA" jipa = 0 jipa = jipa + 1 Else If max < nbhs Then hasil = nbhs jur = "BHS" jbhs = 0 jbhs = jbhs + 1 Else If max = nbhs Then hasil = max jur = "IPA" jipa = 0 jipa = jipa + 1 End If End If End If End If End If End If

Akademik_Output = Str(hasil) & ", " & jur acuan = "Akademik"

Call Save(nis, acuan, jur) Exit Function

Pesan:

MsgBox Err.Number & " - " & Err.Description End

End Function

'Penjurusan Acuan Akademik Private Sub AcnAkademik() With Akademik

.ListItems.Clear .ColumnHeaders.Clear

.ColumnHeaders.Add: .ColumnHeaders(1).Text = "NIS": .ColumnHeaders(1).Width = 1000

.ColumnHeaders.Add: .ColumnHeaders(2).Text = "Nama": .ColumnHeaders(2).Width = 4000

.ColumnHeaders.Add: .ColumnHeaders(3).Text = "Nilai": .ColumnHeaders(3).Width = 1500

.ColumnHeaders.Add: .ColumnHeaders(4).Text = "Jurusan": .ColumnHeaders(4).Width = 1500

MySQL = "select b.NIS from siswa a,raport b where a.NIS=b.NIS group by nis" EKSEKUSI

Do While myRecordset.EOF = False

Set msk = .ListItems.Add(, , myRecordset!nis) myRecordset.MoveNext

Loop

For i = 1 To .ListItems.Count

MySQL = "select * from siswa where nis='" & .ListItems(i).Text & "'" EKSEKUSI .ListItems(i).SubItems(1) = myRecordset!nama .ListItems(i).SubItems(2) = Split(Akademik_Output(.ListItems(i).Text), ", ")(0) .ListItems(i).SubItems(3) = Split(Akademik_Output(.ListItems(i).Text), ", ")(1) Next i Procen_Layout Akademik, 3 End With End Sub 'Pilihan

Private Function Pilihan_output1(nis As String) As String 'melihat prioritas pertama pada pilihan

Dim acuan As String

MySQL = "select * from pilihan where prioritas ='1' and nis='" & nis & "'" EKSEKUSI

Select Case myRecordset!kodeJurs Case Is = "A1"

and status='REMIDI'" EKSEKUSI

If myRecordset.EOF = False And myRecordset.BOF = False Then GoTo prioritas2

Else

MySQL = "select * from raport where nis='" & nis & "' and nilai < 60 and kodeMtp like '%A1%'"

EKSEKUSI

If myRecordset.EOF = False And myRecordset.BOF = False Then GoTo prioritas2

Else

Pilihan_output1 = "IPA, 1(IPA)" jur = "IPA" jipa = 0 jipa = jipa + 1 GoTo selesai End If End If Case Is = "A2"

MySQL = "select * from raport where nis='" & nis & "' and kodemtp like '%A2%' and status='REMIDI'"

EKSEKUSI

If myRecordset.EOF = False And myRecordset.BOF = False Then GoTo prioritas2

Else

MySQL = "select * from raport where nis='" & nis & "' and nilai < 65 and kodeMtp like '%A2%'"

EKSEKUSI

If myRecordset.EOF = False And myRecordset.BOF = False Then GoTo prioritas2

Else

Pilihan_output1 = "IPS, 1(IPS)" jur = "IPS" jips = 0 jips = jips + 1 GoTo selesai End If End If Case Is = "A3"

MySQL = "select * from raport where nis='" & nis & "' and kodemtp like '%A3%' and status='REMIDI'"

EKSEKUSI

If myRecordset.EOF = False And myRecordset.BOF = False Then GoTo prioritas2

Else

MySQL = "select * from raport where nis='" & nis & "' and nilai < 65 and kodeMtp like '%A3%'"

EKSEKUSI

If myRecordset.EOF = False And myRecordset.BOF = False Then GoTo prioritas2 Else Pilihan_output1 = "BHS, 1(BHS)" jur = "BHS" jbhs = 0 jbhs = jbhs + 1 GoTo selesai End If End If End Select prioritas2:

'perhitungan prooritas kedua

MySQL = "select * from pilihan where prioritas ='2' and nis='" & nis & "'" EKSEKUSI

Select Case myRecordset!kodeJurs Case Is = "A1"

MySQL = "select * from raport where nis='" & nis & "' and kodemtp like '%A1%' and status='REMIDI'"

EKSEKUSI

If myRecordset.EOF = False And myRecordset.BOF = False Then GoTo prioritas3

Else

MySQL = "select * from raport where nis='" & nis & "' and nilai < 60 and kodeMtp like '%A1%'"

EKSEKUSI

If myRecordset.EOF = False And myRecordset.BOF = False Then GoTo prioritas3

Else

Pilihan_output1 = "IPA, 2(IPA)" jur = "IPA" jipa = 0 jipa = jipa + 1 GoTo selesai End If End If Case Is = "A2"

MySQL = "select * from raport where nis='" & nis & "' and kodemtp like '%A2%' and status='REMIDI'"

EKSEKUSI

If myRecordset.EOF = False And myRecordset.BOF = False Then GoTo prioritas3

Else

MySQL = "select * from raport where nis='" & nis & "' and nilai < 65 and kodeMtp like '%A2%'"

EKSEKUSI

If myRecordset.EOF = False And myRecordset.BOF = False Then GoTo prioritas3

Else

Pilihan_output1 = "IPS, 2(IPS)" jur = "IPS" jips = 0 jips = jips + 1 GoTo selesai End If End If Case Is = "A3"

MySQL = "select * from raport where nis='" & nis & "' and kodemtp like '%A3%' and status='REMIDI'"

EKSEKUSI

If myRecordset.EOF = False And myRecordset.BOF = False Then GoTo prioritas3

Else

MySQL = "select * from raport where nis='" & nis & "' and nilai < 65 and kodeMtp like '%A3%'"

EKSEKUSI

If myRecordset.EOF = False And myRecordset.BOF = False Then GoTo prioritas3 Else Pilihan_output1 = "BHS, 2(BHS)" jur = "BHS" jbhs = 0 jbhs = jbhs + 1 GoTo selesai End If End If End Select

'perhitungan prioritas ketiga prioritas3:

MySQL = "select * from pilihan where prioritas ='3' and nis='" & nis & "'" EKSEKUSI

Select Case myRecordset!kodeJurs Case Is = "A1"

MySQL = "select * from raport where nis='" & nis & "' and kodemtp like '%A1%' and status='REMIDI'"

EKSEKUSI

jur = "***" GoTo selesai Else

MySQL = "select * from raport where nis='" & nis & "' and nilai < 60 and kodeMtp like '%A1%'"

EKSEKUSI

If myRecordset.EOF = False And myRecordset.BOF = False Then Pilihan_output1 = "***, ***"

jur = "***" GoTo selesai Else

Pilihan_output1 = "IPA, 3(IPA)" jur = "IPA" jipa = 0 jipa = jipa + 1 GoTo selesai End If End If Case Is = "A2"

MySQL = "select * from raport where nis='" & nis & "' and kodemtp like '%A2%' and status='REMIDI'"

EKSEKUSI

If myRecordset.EOF = False And myRecordset.BOF = False Then Pilihan_output1 = "***, ***"

jur = "***" GoTo selesai Else

MySQL = "select * from raport where nis='" & nis & "' and nilai < 65 and kodeMtp like '%A2%'"

EKSEKUSI

If myRecordset.EOF = False And myRecordset.BOF = False Then Pilihan_output1 = "***, ***"

jur = "***" GoTo selesai Else

Pilihan_output1 = "IPS, 3(IPS)" jur = "IPS" jips = 0 jips = jips + 1 GoTo selesai End If End If Case Is = "A3"

MySQL = "select * from raport where nis='" & nis & "' and kodemtp like '%A3%' and status='REMIDI'"

EKSEKUSI

If myRecordset.EOF = False And myRecordset.BOF = False Then Pilihan_output1 = "***, ***"

jur = "***" GoTo selesai Else

MySQL = "select * from raport where nis='" & nis & "' and nilai < 65 and kodeMtp like '%A3%'"

EKSEKUSI

If myRecordset.EOF = False And myRecordset.BOF = False Then Pilihan_output1 = "***, ***" jur = "***" GoTo selesai Else Pilihan_output1 = "BHS, 3(BHS)" jur = "BHS" jbhs = 0 jbhs = jbhs + 1 GoTo selesai End If End If End Select selesai:

acuan = "Pilihan"

Call Save(nis, acuan, jur) Exit Function

End Function

'Penurusan Acuan Pilihan Private Sub AcnPilihan() With Akademik

.ListItems.Clear .ColumnHeaders.Clear

.ColumnHeaders.Add: .ColumnHeaders(1).Text = "NIS": .ColumnHeaders(1).Width = 1000

.ColumnHeaders.Add: .ColumnHeaders(2).Text = "Nama": .ColumnHeaders(2).Width = 4000

.ColumnHeaders.Add: .ColumnHeaders(3).Text = "Jurusan": .ColumnHeaders(3).Width = 1500

.ColumnHeaders.Add: .ColumnHeaders(4).Text = "Pilihan": .ColumnHeaders(4).Width = 1500

MySQL = "select b.NIS from siswa a,pilihan b where a.NIS=b.NIS group by nis" EKSEKUSI

Do While myRecordset.EOF = False

Set msk = .ListItems.Add(, , myRecordset!nis) myRecordset.MoveNext

Loop

For i = 1 To Akademik.ListItems.Count

MySQL = "select * from siswa where nis='" & .ListItems(i).Text & "'" EKSEKUSI .ListItems(i).SubItems(1) = myRecordset!nama If Pilihan_output1(.ListItems(i).Text) <> "" Then .ListItems(i).SubItems(2) = Split(Pilihan_output1(.ListItems(i).Text), ", ")(0) .ListItems(i).SubItems(3) = Split(Pilihan_output1(.ListItems(i).Text), ", ")(1) End If Next i Procen_Layout Akademik, 2 End With End Sub 'Tpa

Private Function TPA_Output(nis As String) As String Dim bipa, bips, bbhs As Double

Dim acuan As String Dim bakat As String

MySQL = "select * from tpa where nis='" & nis & "'" EKSEKUSI

Do While myRecordset.EOF = False If myRecordset!kodePA = "BA1" Then bipa = myRecordset!nilaiPa End If

If myRecordset!kodePA = "BA2" Then bips = myRecordset!nilaiPa End If

If myRecordset!kodePA = "BA3" Then bbhs = myRecordset!nilaiPa End If

myRecordset.MoveNext Loop

If bipa > bips Then max = bipa

If max > bbhs Then

MySQL = "select * from raport where nis='" & nis & "' and nilai >= 60 and status='NONREMIDI' and kodeMtp like '%A1%'"

EKSEKUSI

If myRecordset.EOF = False And myRecordset.BOF = False Then bakat = "IPA" jur = "IPA" jipa = 0 jipa = jipa + 1 Else bakat = "IPA" jur = "***"

Else

If max < bbhs Then

MySQL = "select * from raport where nis='" & nis & "' and nilai >= 65 and status='NONREMIDI' and kodeMtp like '%A3%'"

EKSEKUSI

If myRecordset.EOF = False And myRecordset.BOF = False Then bakat = "BHS" jur = "BHS" jbhs = 0 jbhs = jbhs + 1 Else bakat = "BHS" jur = "***" End If Else If max = bbhs Then

MySQL = "select * from raport where nis='" & nis & "' and nilai >= 60 and status='NONREMIDI' and kodeMtp like '%A1%'"

EKSEKUSI

If myRecordset.EOF = False And myRecordset.BOF = False Then bakat = "IPA" jur = "IPA" jipa = 0 jipa = jipa + 1 Else bakat = "IPA" jur = "***" End If End If End If End If Else

If bipa < bips Then max = bips

If max > bbhs Then

MySQL = "select * from raport where nis='" & nis & "' and nilai >= 65 and status='NONREMIDI' and kodeMtp like '%A2%'"

EKSEKUSI

If myRecordset.EOF = False And myRecordset.BOF = False Then bakat = "IPS" jur = "IPS" jips = 0 jips = jips + 1 Else bakat = "IPS" jur = "***" End If Else If max < bbhs Then

MySQL = "select * from raport where nis='" & nis & "' and nilai >= 65 and status='NONREMIDI' and kodeMtp like '%A3%'"

EKSEKUSI

If myRecordset.EOF = False And myRecordset.BOF = False Then bakat = "BHS" jur = "BHS" jbhs = 0 jbhs = jbhs + 1 Else bakat = "BHS" jur = "***" End If Else If max = bbhs Then

MySQL = "select * from raport where nis='" & nis & "' and nilai >= 65 and status='NONREMIDI' and kodeMtp like '%A2%'"

EKSEKUSI

If myRecordset.EOF = False And myRecordset.BOF = False Then bakat = "IPS"

jur = "IPS" jips = 0

jips = jips + 1 Else bakat = "IPS" jur = "***" End If End If End If End If Else

If bipa = bips Then max = bipa

If max > bbhs Then

MySQL = "select * from raport where nis='" & nis & "' and nilai >= 60 and status='NONREMIDI' and kodeMtp like '%A1%'"

EKSEKUSI

If myRecordset.EOF = False And myRecordset.BOF = False Then bakat = "IPA" jur = "IPA" jipa = 0 jipa = jipa + 1 Else bakat = "IPA" jur = "***" End If Else If max < bbhs Then

MySQL = "select * from raport where nis='" & nis & "' and nilai >= 65 and status='NONREMIDI' and kodeMtp like '%A3%'"

EKSEKUSI

If myRecordset.EOF = False And myRecordset.BOF = False Then bakat = "BHS" jur = "BHS" jbhs = 0 jbhs = jbhs + 1 Else bakat = "BHS" jur = "***" End If Else If max = bbhs Then

MySQL = "select * from raport where nis='" & nis & "' and nilai >= 60 and status='NONREMIDI' and kodeMtp like '%A1%'"

EKSEKUSI

If myRecordset.EOF = False And myRecordset.BOF = False Then bakat = "IPA" jur = "IPA" jipa = 0 jipa = jipa + 1 Else bakat = "IPA" jur = "***" End If End If End If End If End If End If End If

TPA_Output = bakat & ", " & jur acuan = "Khusus"

Call Save(nis, acuan, jur) Exit Function

Pesan:

MsgBox Err.Number & " - " & Err.Description End

End Function

Private Sub AcnKhusus() With Akademik

.ListItems.Clear .ColumnHeaders.Clear

1000

.ColumnHeaders.Add: .ColumnHeaders(2).Text = "Nama": .ColumnHeaders(2).Width = 4000

.ColumnHeaders.Add: .ColumnHeaders(3).Text = "Jurusan": .ColumnHeaders(3).Width = 1500

.ColumnHeaders.Add: .ColumnHeaders(4).Text = "Bakat": .ColumnHeaders(4).Width = 1500

MySQL = "select b.NIS from siswa a,tpa b where a.NIS=b.NIS group by nis" EKSEKUSI

Do While myRecordset.EOF = False

Set msk = .ListItems.Add(, , myRecordset!nis) myRecordset.MoveNext

Loop

For i = 1 To Akademik.ListItems.Count

MySQL = "select * from siswa where nis='" & .ListItems(i).Text & "'" EKSEKUSI .ListItems(i).SubItems(1) = myRecordset!nama If TPA_Output(.ListItems(i).Text) <> "" Then .ListItems(i).SubItems(2) = Split(TPA_Output(.ListItems(i).Text), ", ")(1) .ListItems(i).SubItems(3) = Split(TPA_Output(.ListItems(i).Text), ", ")(0) End If Next i Procen_Layout Akademik, 2 End With End Sub

Private Sub Form_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)

If Button = 2 Then PopupMenu Menu End If

End Sub

Private Sub Refresh_Click() Akademik.ColumnHeaders.Clear Shape1.Visible = False Shape2.Visible = False Shape3.Visible = False txtFields(0).Text = "" txtFields(1).Text = "" txtFields(2).Text = "" txtFields(3).Text = "" Akd.Checked = False Pil.Checked = False Khs.Checked = False End Sub

Private Sub Save(nis As String, acuan As String, jur As String)

MySQL = "select * from alternatif where nis='" & nis & "' And acuan='" & acuan & "'"

EKSEKUSI

If myRecordset.BOF = False And myRecordset.EOF = False Then

MySQL = "update alternatif set jurusan='" & jur & "' where nis='" & nis & "' And acuan='" & acuan & "'"""

EKSEKUSI Else

MySQL = "INSERT INTO alternatif (NIS,acuan,jurusan) VALUES ('" & nis & "','" & acuan & "','" & jur & "')"

EKSEKUSI End If End Sub

Dim i As Integer

Private Sub Command_Click(index As Integer) Dim jur As String

Select Case index Case Is = 0 With Alternatif

For i = 1 To .ListItems.Count

MySQL = "select * from alternatif where NIS='" &

.ListItems(i).SubItems(1) & "' and acuan='" & Combo.Text & "'" EKSEKUSI

If myRecordset.EOF = False And myRecordset.BOF = False Then .ListItems(i).SubItems(6) = myRecordset!Jurusan

MySQL = "update siswa set jurusan='" & .ListItems(i).SubItems(6) & "' where nis='" & .ListItems(i).SubItems(1) & "'"

EKSEKUSI End If Next i End With Case Is = 1 Unload Me End Select End Sub

Private Sub Form_Load() Connecting

Alternatif_Output End Sub

Private Sub Alternatif_Output() MySQL = "select * from siswa " EKSEKUSI

With Alternatif .ListItems.Clear

Do While myRecordset.EOF = False

Set msk = .ListItems.Add(, , .ListItems.Count + 1)

.ListItems(.ListItems.Count).SubItems(1) = myRecordset!nis .ListItems(.ListItems.Count).SubItems(2) = myRecordset!nama myRecordset.MoveNext

Loop

For i = 1 To .ListItems.Count

MySQL = "select * from alternatif where NIS='" & .ListItems(i).SubItems(1) & "' and acuan='AKADEMIK'"

EKSEKUSI

If myRecordset.EOF = False And myRecordset.BOF = False Then .ListItems(i).SubItems(3) = myRecordset!Jurusan

End If

MySQL = "select * from alternatif where NIS='" & .ListItems(i).SubItems(1) & "' and acuan='PILIHAN'"

EKSEKUSI

If myRecordset.EOF = False And myRecordset.BOF = False Then .ListItems(i).SubItems(4) = myRecordset!Jurusan

End If

MySQL = "select * from alternatif where NIS='" & .ListItems(i).SubItems(1) & "' and acuan='KHUSUS'"

EKSEKUSI

If myRecordset.EOF = False And myRecordset.BOF = False Then .ListItems(i).SubItems(5) = myRecordset!Jurusan End If Next i End With Exit Sub Pesan:

MsgBox Err.Number & " - " & Err.Description End

End Sub

Proses Pengolahan Data

Dim i As Integer

Private Sub Form_Load() Guru_Output

SetButtons True Kunci

End Sub

Private Sub Guru_Output()

MySQL = "select * from guru ORDER BY NIP ASC" EKSEKUSI

Do While myRecordset.EOF = False

Set msk = .ListItems.Add(, , .ListItems.Count + 1)

.ListItems(.ListItems.Count).SubItems(1) = myRecordset!NIP .ListItems(.ListItems.Count).SubItems(2) = myRecordset!namaGuru .ListItems(.ListItems.Count).SubItems(3) = myRecordset!Sex .ListItems(.ListItems.Count).SubItems(4) = myRecordset!Agama .ListItems(.ListItems.Count).SubItems(5) = myRecordset!golongan myRecordset.MoveNext Loop End With End Sub

Private Sub Guru_Click() With Guru txtFields(0).Text = .ListItems(.SelectedItem.index).SubItems(1) txtFields(1).Text = .ListItems(.SelectedItem.index).SubItems(2) txtFields(2).Text = .ListItems(.SelectedItem.index).SubItems(5) Combo(0).Text = .ListItems(.SelectedItem.index).SubItems(3) Combo(1).Text = .ListItems(.SelectedItem.index).SubItems(4) End With End Sub

Private Sub Command_Click(index As Integer) Select Case index

Case Is = 0 BukaKunci AddNew

SetButtons False Case Is = 1

MySQL = "select * from guru where NIP='" & txtFields(0).Text & "'" EKSEKUSI

If myRecordset.BOF = False And myRecordset.EOF = False Then

press = MsgBox(" Maaf Data ini sudah ada ! " & vbCrLf & " Apakah Anda yakin akan mengubah data ?", vbQuestion + vbYesNo, "Update Data")

If press = vbYes Then

MySQL = "update guru set namaGuru='" & txtFields(1).Text & "',sex='" & Combo(0).Text & "',agama='" & Combo(1).Text & "',golongan='" & txtFields(2).Text & "' where NIP='" & txtFields(0).Text & "'"

EKSEKUSI End If Else

MySQL = "INSERT INTO guru(NIP, namaGuru,sex,agama,golongan) VALUES ('" & txtFields(0).Text & "', '" & txtFields(1).Text & "','" & Combo(0).Text & "','" & Combo(1).Text & "','" & txtFields(2).Text & "')"

EKSEKUSI End If Reset Case Is = 2 With Guru

MySQL = "select * from guru where NIP='" & .ListItems(.SelectedItem.index).SubItems(1) & "'"

EKSEKUSI

If myRecordset.EOF = False And myRecordset.BOF = False Then

press = MsgBox("Apakah Anda yakin akan menghapus data ? ", vbQuestion + vbYesNo, "Penghapusan")

If press = vbYes Then

MySQL = "delete from guru where NIP='" &

.ListItems(.SelectedItem.index).SubItems(1) & "'" EKSEKUSI

End If Reset Else

MsgBox "Data yang akan Anda hapus tidak ada", vbCritical, "Penghapusan Ditolak" End If End With Case Is = 3 SetButtons False With Guru txtFields(0).Text = .ListItems(.SelectedItem.index).SubItems(1) txtFields(1).Text = .ListItems(.SelectedItem.index).SubItems(2) txtFields(2).Text = .ListItems(.SelectedItem.index).SubItems(5)

Combo(0).Text = .ListItems(.SelectedItem.index).SubItems(3) Combo(1).Text = .ListItems(.SelectedItem.index).SubItems(4) End With Edit Case Is = 4 Reset Case Is = 5 Unload Me End Select End Sub Sub Reset() AddNew Kunci Guru_Output SetButtons True End Sub

Private Sub txtFields_KeyPress(index As Integer, KeyAscii As Integer) Select Case index

Case 0 To 1

If KeyAscii = 13 Then SendKeys "{Tab}" End Select End Sub Sub Kunci() For i = 0 To 2 txtFields(i).Locked = True txtFields(i).BackColor = vbWhite Next i For i = 0 To 1 Combo(i).Locked = True Combo(i).BackColor = vbWhite Next i End Sub Sub Edit() For i = 1 To 2 txtFields(i).Locked = False txtFields(i).BackColor = vbYellow Next i For i = 0 To 1 Combo(i).Locked = False Combo(i).BackColor = vbYellow Next i End Sub Sub BukaKunci() For i = 0 To 2 txtFields(i).Locked = False txtFields(i).BackColor = vbYellow Next i For i = 0 To 1 Combo(i).Locked = False Combo(i).BackColor = vbYellow Next i End Sub Sub AddNew() For i = 0 To 2 txtFields(i).Text = "" Next i txtFields(0).SetFocus End Sub

Private Sub SetButtons(bVal As Boolean) Command(0).Enabled = bVal

Command(1).Enabled = Not bVal Command(2).Enabled = bVal Command(3).Enabled = bVal Command(4).Enabled = Not bVal Command(5).Enabled = bVal End Sub

Dim i As Integer

Private Sub Form_Load() Jurusan_Output

Kunci End Sub

Private Sub Jurusan_Output()

MySQL = "select * from jurusan ORDER BY kodeJurs ASC" EKSEKUSI

With Jurusan .ListItems.Clear

Do While myRecordset.EOF = False

Dokumen terkait