• Tidak ada hasil yang ditemukan

Manual Book Program Sistem Informasi Akademik

N/A
N/A
Protected

Academic year: 2021

Membagikan "Manual Book Program Sistem Informasi Akademik"

Copied!
127
0
0

Teks penuh

(1)

1

Manual Book Program Sistem Informasi Akademik

Pada saat pertama kali membuka aplikasi maka akan langsung tampil form untuk login seperti dibawah ini :

Coding Program Login

Dim a, b As Byte Sub bersih()

Dim kontrol As Control

For Each kontrol In Me.Controls

If TypeOf kontrol Is TextBox Then kontrol.Text = "" Next

End Sub

Private Sub cmdclear_Click() Form_Load

End Sub

Private Sub cmdexit_Click()

a = MsgBox("Tutup Program???", vbYesNo + vbQuestion, "Konfirmasi") If a = vbYes Then End Else Form_Load End If End Sub

(2)

2 Private Sub cmdlogin_Click()

Call koneksi

rsuser.Open "Select * from user", KON If txtlevel.Text = "Admin" Then

form_login.Hide progress.Show menu_utama.mnlaporan.Enabled = False menu_utama.mnproses.Enabled = False menu_utama.StatusBar1.Panels(2) = form_login.txtnama.Text menu_utama.StatusBar1.Panels(3) = form_login.txtlevel.Text menu_utama.StatusBar1.Panels(1) = form_login.txtuser.Text menu_utama.StatusBar1.Panels(4) = form_login.txtnik.Text proses_absen.txtid.Caption = form_login.txtuser.Text proses_nilai.txtid.Caption = form_login.txtuser.Text laporan_nilai.txtrapot.Enabled = False laporan_nilai.optrapot.Enabled = False ElseIf txtlevel.Text = "Pengajar" Then

If txtjabatan.Text = "Kepala Sekolah" Then form_login.Hide progress.Show menu_utama.mnfile.Enabled = False menu_utama.mnbackup.Enabled = False menu_utama.mnabsen.Enabled = False menu_utama.StatusBar1.Panels(2) = form_login.txtnama.Text menu_utama.StatusBar1.Panels(3) = form_login.txtlevel.Text menu_utama.StatusBar1.Panels(1) = form_login.txtuser.Text menu_utama.StatusBar1.Panels(4) = form_login.txtnik.Text

(3)

3

proses_absen.txtid.Caption = form_login.txtuser.Text proses_nilai.txtid.Caption = form_login.txtuser.Text laporan_nilai.txtrapot.Enabled = False

laporan_nilai.optrapot.Enabled = False

ElseIf txtjabatan.Text = "Wakil Kepala Sekolah" Then form_login.Hide progress.Show menu_utama.mnfile.Enabled = False menu_utama.mnbackup.Enabled = False menu_utama.mnabsen.Enabled = False laporan_nilai.txtrapot.Enabled = False menu_utama.StatusBar1.Panels(2) = form_login.txtnama.Text menu_utama.StatusBar1.Panels(3) = form_login.txtlevel.Text menu_utama.StatusBar1.Panels(1) = form_login.txtuser.Text menu_utama.StatusBar1.Panels(4) = form_login.txtnik.Text proses_absen.txtid.Caption = form_login.txtuser.Text proses_nilai.txtid.Caption = form_login.txtuser.Text laporan_nilai.optrapot.Enabled = False

ElseIf txtjabatan.Text = "Wali Kelas" Then form_login.Hide progress.Show menu_utama.mnfile.Enabled = False menu_utama.mnlapguru.Enabled = False menu_utama.mnlapkelas.Enabled = False menu_utama.mnlappelajaran.Enabled = False menu_utama.mnlapsiswa.Enabled = False menu_utama.mnlapjadwal.Enabled = False menu_utama.mnbackup.Enabled = False

(4)

4 menu_utama.StatusBar1.Panels(2) = form_login.txtnama.Text menu_utama.StatusBar1.Panels(3) = form_login.txtlevel.Text menu_utama.StatusBar1.Panels(1) = form_login.txtuser.Text menu_utama.StatusBar1.Panels(4) = form_login.txtnik.Text proses_absen.txtid.Caption = form_login.txtuser.Text proses_nilai.txtid.Caption = form_login.txtuser.Text ElseIf txtjabatan.Text = "Guru" Then

form_login.Hide progress.Show menu_utama.mnfile.Enabled = False menu_utama.mnlaporan.Enabled = False menu_utama.mnabsen.Enabled = False menu_utama.mnbackup.Enabled = False menu_utama.StatusBar1.Panels(2) = form_login.txtnama.Text menu_utama.StatusBar1.Panels(3) = form_login.txtlevel.Text menu_utama.StatusBar1.Panels(1) = form_login.txtuser.Text menu_utama.StatusBar1.Panels(4) = form_login.txtnik.Text proses_absen.txtid.Caption = form_login.txtuser.Text proses_nilai.txtid.Caption = form_login.txtuser.Text laporan_nilai.optrapot.Enabled = False End If End If End Sub

Private Sub Form_Load() bersih

cmdlogin.Enabled = False txtuser.Enabled = True

(5)

5 Label1.Visible = True

Label2.Visible = True txtpassword.Enabled = False

End Sub

Private Sub txtpassword_KeyPress(KeyAscii As Integer) KeyAscii = Asc(UCase(Chr(KeyAscii)))

If KeyAscii = 13 Then Call koneksi

rsuser.Open "Select * from user where id_user='" & txtuser.Text & "' and pass_user='" & txtpassword.Text & "'", KON

If rsuser.EOF Then

MsgBox "Password Salah" txtpassword = "" txtpassword.SetFocus Else cmdlogin.Enabled = True txtpassword.Enabled = False cmdlogin.SetFocus txtlevel.Text = rsuser!status_user txtnama.Text = rsuser!nama_user If txtlevel.Text = "Pengajar" Then txtnik.Text = rsuser!nik

guru = "select * from guru where nik='" & txtnik.Text & "'" Set rsguru = KON.Execute(guru)

With rsguru

If txtnik.Text = .Fields("nik") Then txtjabatan.Text = .Fields("jbtn_guru")

(6)

6 End If

End With

ElseIf txtlevel.Text = "Admin" Then cmdlogin.SetFocus

End If End If End If End Sub

Private Sub txtuser_KeyPress(KeyAscii As Integer) KeyAscii = Asc(UCase(Chr(KeyAscii)))

If KeyAscii = 13 Then Call koneksi

rsuser.Open "Select id_user from user where id_user ='" & txtuser & "'", KON If rsuser.EOF Then

MsgBox "Username Salah" txtuser = "" txtuser.SetFocus Else txtuser.Enabled = False txtpassword.Enabled = True txtpassword.SetFocus End If End If End Sub

(7)

7

Masukkan username dan password sesuai dengan yang sudah ada di dalam database lalu klik login maka akan masuk ke dalam menu utama, klik exit untuk keluar dari program, dan klik clear untuk membersihkan inputan login. Untuk menu utama terbagi menjadi lima hak akses yaitu hak akses “TU”, hak akses “Kepala Sekolah”, hak akses “Wakil Kepala Sekolah”, hak akses “Wali Kelas” dan hak akses “Guru”. Berikut tampilan menu utama dari program sistem informasi akademik:

Coding Program Menu Utama

Private Sub Label10_Click() proses_absen.Show

menu_utama.Enabled = False End Sub

Private Sub mnabsen_Click() proses_absen.Show

menu_utama.Enabled = False End Sub

Private Sub mnbackup_Click() backup_data.Show

menu_utama.Enabled = False End Sub

(8)

8 Private Sub mnexit_Click()

a = MsgBox("Keluar dari program?", vbQuestion + vbYesNo, "Konfirmasi") If a = vbYes Then

End End If End Sub

Private Sub mnganti_Click() ganti_password.Show

menu_utama.Enabled = False End Sub

Private Sub mnguru_Click() data_guru.Show

menu_utama.Enabled = False End Sub

Private Sub mnjurusan_Click() data_jurusan.Show

menu_utama.Enabled = False End Sub

Private Sub mnkelas_Click() data_kelas.Show

menu_utama.Enabled = False End Sub

Private Sub mnlapabsen_Click() laporan_absen.Show

menu_utama.Enabled = False End Sub

Private Sub mnlapguru_Click() crguru.RetrieveDataFiles

crguru.WindowState = crptMaximized crguru.Action = 1

End Sub

Private Sub mnlapjadwal_Click() laporan_jadwal.Show

(9)

9 End Sub

Private Sub mnlapjurusan_Click() crjurusan.RetrieveDataFiles

crjurusan.WindowState = crptMaximized crjurusan.Action = 1

End Sub

Private Sub mnlapkelas_Click() crkelas.RetrieveDataFiles

crkelas.WindowState = crptMaximized crkelas.Action = 1

End Sub

Private Sub mnlapnilai_Click() laporan_nilai.Show

menu_utama.Enabled = False End Sub

Private Sub mnlappelajaran_Click() crpelajaran.RetrieveDataFiles

crpelajaran.WindowState = crptMaximized crpelajaran.Action = 1

End Sub

Private Sub mnlapsiswa_Click() laporan_siswa.Show

menu_utama.Enabled = False End Sub

Private Sub mnnilai_Click() proses_nilai.Show

menu_utama.Enabled = False End Sub

Private Sub mnpelajaran_Click() data_matpel.Show

menu_utama.Enabled = False End Sub

Private Sub mnsiswa_Click() data_siswa.Show

(10)

10 menu_utama.Enabled = False

End Sub

Private Sub mnuser_Click() data_user.Show

menu_utama.Enabled = False End Sub

Private Sub Timer1_Timer() StatusBar1.Panels(5).Text = Time

StatusBar1.Panels(6).Text = Format(Date, "DDDD , dd mmmm yyyy") End Sub

(11)

11

A. Data Guru

Menu ini adalah untuk menambahkan data guru yang nantinya akan digunakan dalam proses pengolahan data akademik dan juga dalam memproses data user.

➢ Klik Add untuk menambahkan data guru baru, nig (no induk guru) akan muncul otomatis berdasarkan tahun masuk guru serta bulan masuk guru dan nomor urut guru

➢ Klik Save untuk menyimpan data guru baru ➢ Klik Cancel untuk membatalkan proses

➢ Klik baris nik dan nama guru lalu klik Edit untuk mengubah data guru ➢ Klik Delete untuk menghapus data guru

➢ Klik Find untuk mencari data guru maka data di dalam grid hanya akan muncul sesuai dengan data yang dicari saja

➢ Klik Exit untuk keluar dari form data guru

Coding Program Data Guru

Dim tambah As Boolean Sub nonaktif()

Dim kontrol As Control

For Each kontrol In Me.Controls

(12)

12 Next Toolbar1.Buttons(1).Enabled = True Toolbar1.Buttons(2).Enabled = False Toolbar1.Buttons(3).Enabled = False Toolbar1.Buttons(4).Enabled = False Toolbar1.Buttons(5).Enabled = False Toolbar1.Buttons(6).Enabled = True Toolbar1.Buttons(7).Enabled = True dttanggal.Enabled = False cmbagama.Enabled = False optlaki.Enabled = False optperempuan.Enabled = False cmbstatus.Enabled = False cmbpendidikan.Enabled = False cmbjabatan.Enabled = False optnig.Enabled = False optnama.Enabled = False End Sub Sub aktif()

Dim kontrol As Control

For Each kontrol In Me.Controls

If TypeOf kontrol Is TextBox Then kontrol.Enabled = True Next Toolbar1.Buttons(1).Enabled = False Toolbar1.Buttons(2).Enabled = True Toolbar1.Buttons(3).Enabled = True Toolbar1.Buttons(4).Enabled = False Toolbar1.Buttons(5).Enabled = False

(13)

13 Toolbar1.Buttons(6).Enabled = False Toolbar1.Buttons(7).Enabled = True dttanggal.Enabled = True cmbagama.Enabled = True optlaki.Enabled = True optperempuan.Enabled = True cmbstatus.Enabled = True cmbpendidikan.Enabled = True cmbjabatan.Enabled = True optnig.Enabled = False optnama.Enabled = False End Sub Sub bersih()

For Each kontrol In Me.Controls

If TypeOf kontrol Is TextBox Then kontrol.Text = "" Next

cmbagama.Text = "Pilih Agama" optlaki.Value = False

optperempuan.Value = False cmbstatus.Text = "Pilih Status"

cmbpendidikan.Text = "Pilih Pendidikan" cmbjabatan.Text = "Pilih Jabatan"

optnig.Value = False optnama.Value = False End Sub

Sub tampilgrid() Call koneksi

(14)

14 Set grid.DataSource = rsguru

aturgrid End Sub

Sub simpanguru() Dim a As String

a = Format(Me.dttanggal.Value, "YYYY/MM/DD") If optlaki.Value = True Then

Savelaki = "insert into guru values('" & txtnig.Text & "','" & txtnama.Text & "','" & txttempat.Text & "','" & a & "','" & cmbagama.Text & "','" & optlaki.Caption & "','" &

txtalamat.Text & "','" & cmbpendidikan.Text & "','" & cmbstatus.Text & "','" & txttelp.Text & "','" & txtemail.Text & "','" & cmbjabatan.Text & "','" & txtpassword.Text & "')"

KON.Execute Savelaki

ElseIf optperempuan.Value = True Then

Savecewe = "insert into guru values('" & txtnig.Text & "','" & txtnama.Text & "','" & txttempat.Text & "','" & a & "','" & cmbagama.Text & "','" & optperempuan.Caption & "','" & txtalamat.Text & "','" & cmbpendidikan.Text & "','" & cmbstatus.Text & "','" & txttelp.Text & "','" & txtemail.Text & "','" & cmbjabatan.Text & "','" & txtpassword.Text & "')"

KON.Execute Savecewe End If End Sub Sub updateguru() Dim a As String a = Format(Me.dttanggal.Value, "YYYY/MM/DD")

ubah = "update guru set nama_guru='" & txtnama.Text & "',tgllahir_guru = '" & a & "',tmptlahir_guru='" & txttempat.Text & "',agama_guru='" & cmbagama.Text & "',alamat_guru='" & txtalamat.Text & "',pend_guru='" & cmbpendidikan.Text &

"',status_kawin='" & cmbstatus.Text & "',telp_guru='" & txttelp.Text & "',email_guru='" & txtemail.Text & "',jbtn_guru='" & cmbjabatan.Text & "',pass_guru='" & txtpassword.Text & "' where nik='" & txtnig.Text & "'"

KON.Execute ubah End Sub

(15)

15 Private Sub cmbagama_KeyPress(KeyAscii As Integer)

If Not (KeyAscii >= Asc("0") And KeyAscii <= Asc("9") And (KeyAscii >= Asc("a") And KeyAscii <= Asc("z") And KeyAscii = 46 Or KeyAscii = vbKeyBack)) Then KeyAscii = 0 End Sub

Private Sub cmbjabatan_KeyPress(KeyAscii As Integer)

If Not (KeyAscii >= Asc("0") And KeyAscii <= Asc("9") And (KeyAscii >= Asc("a") And KeyAscii <= Asc("z") And KeyAscii = 46 Or KeyAscii = vbKeyBack)) Then KeyAscii = 0 End Sub

Private Sub cmbpendidikan_KeyPress(KeyAscii As Integer)

If Not (KeyAscii >= Asc("0") And KeyAscii <= Asc("9") And (KeyAscii >= Asc("a") And KeyAscii <= Asc("z") And KeyAscii = 46 Or KeyAscii = vbKeyBack)) Then KeyAscii = 0 End Sub

Private Sub cmbstatus_KeyPress(KeyAscii As Integer)

If Not (KeyAscii >= Asc("0") And KeyAscii <= Asc("9") And (KeyAscii >= Asc("a") And KeyAscii <= Asc("z") And KeyAscii = 46 Or KeyAscii = vbKeyBack)) Then KeyAscii = 0 End Sub

Private Sub Form_Load() tampilgrid

nonaktif bersih

dttanggal.Visible = True End Sub

Private Sub optnama_Click() txtcari.Enabled = True txtcari.SetFocus End Sub

Private Sub optnig_Click() txtcari.Enabled = True txtcari.SetFocus

(16)

16 End Sub

Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button) If Button.Index = 1 Then aktif bersih tambah = True nomor txtpassword.Text = "5mkpr10k1" txtpassword.Enabled = False txtnig.Enabled = False txtnama.SetFocus

ElseIf Button.Index = 2 Then

If txtnig.Text = "" Or txtnama.Text = "" Or txttempat.Text = "" Or cmbagama.Text = "" Or txtalamat.Text = "" Or optlaki.Value = False And optperempuan.Value = False Or

cmbstatus.Text = "" Or cmbpendidikan.Text = "" Or txttelp.Text = "" Or txtemail.Text = "" Or cmbjabatan.Text = "" Then

MsgBox "Silahkan Lengkapi Data!!", vbInformation, "Informasi" If txtnama.Text = "" Then

txtnama.SetFocus

ElseIf txttempat.Text = "" Then txttempat.SetFocus

ElseIf cmbagama.Text = "" Then cmbagama.SetFocus

ElseIf txtalamat.Text = "" Then txtalamat.SetFocus

ElseIf optlaki.Value = False And optperempuan.Value = False Then optlaki.SetFocus

(17)

17 cmbstatus.SetFocus

ElseIf cmbpendidikan.Text = "" Then cmbpendidikan.SetFocus

ElseIf txttelp.Text = "" Then txttelp.SetFocus

ElseIf cmbjabatan.Text = "" Then cmbjabatan.SetFocus

End If Exit Sub End If

If tambah = True Then simpanguru

grid.Refresh Form_Load

ElseIf tambah = False Then updateguru

grid.Refresh Form_Load End If

ElseIf Button.Index = 3 Then Form_Load

ElseIf Button.Index = 4 Then tambah = False aktif txtnig.Enabled = False txtnama.SetFocus optlaki.Enabled = False optperempuan.Enabled = False

(18)

18 dttanggal.Visible = True Toolbar1.Buttons(3).Enabled = True Toolbar1.Buttons(2).Enabled = True Toolbar1.Buttons(1).Enabled = False Toolbar1.Buttons(4).Enabled = False Toolbar1.Buttons(5).Enabled = False Toolbar1.Buttons(6).Enabled = False ElseIf Button.Index = 5 Then

Call koneksi

rsguru.Open "select * from guru ", KON With rsguru

If Not (.BOF And .EOF) Then

h = MsgBox("Hapus Data Guru ?", vbQuestion + vbYesNo, "Konfirmasi") If h = vbYes Then

hapus = "delete from guru where nik='" & txtnig.Text & "'" KON.Execute (hapus) grid.Refresh Form_Load Else Form_Load End If End If End With grid.Refresh

ElseIf Button.Index = 6 Then optnig.Enabled = True optnama.Enabled = True txtcari.Enabled = False

(19)

19 ElseIf Button.Index = 7 Then

Unload form_guru menu_utama.Enabled = True menu_utama.Show End If End Sub Sub aturgrid() grid.ColWidth(0) = 0 grid.ColWidth(1) = 2000 grid.ColWidth(2) = 2500 grid.ColWidth(3) = 2000 grid.ColWidth(4) = 2000 grid.ColWidth(5) = 2000 grid.ColWidth(6) = 2000 grid.ColWidth(7) = 2000 grid.ColWidth(8) = 2000 grid.ColWidth(9) = 2000 grid.ColWidth(10) = 2000 grid.ColWidth(11) = 2000 grid.ColWidth(12) = 2000 grid.ColWidth(13) = 2000 grid.TextMatrix(0, 1) = "NIG"

grid.TextMatrix(0, 2) = "Nama Guru" grid.TextMatrix(0, 3) = "Tempat Lahir" grid.TextMatrix(0, 4) = "Tanggal Lahir" grid.TextMatrix(0, 5) = "Agama" grid.TextMatrix(0, 6) = "Jenis Kelamin" grid.TextMatrix(0, 7) = "Alamat"

(20)

20 grid.TextMatrix(0, 8) = "Pendidikan"

grid.TextMatrix(0, 9) = "Status Nikah" grid.TextMatrix(0, 10) = "Telepon" grid.TextMatrix(0, 11) = "Email" grid.TextMatrix(0, 12) = "Jabatan" grid.TextMatrix(0, 13) = "Password" End Sub Sub tampilguru() Call koneksi

If optnig.Value = True Then

rsguru.Open "select * from guru where nik like '%" & txtcari.Text & "%'", KON Set grid.DataSource = rsguru

aturgrid

ElseIf optnama.Value = True Then

rsguru.Open "select * from guru where nama_guru like '%" & txtcari.Text & "%'", KON Set grid.DataSource = rsguru

aturgrid End If End Sub Sub sqlguru()

If optnig.Value = True Then

sql1 = "select * from guru where nik like '%" & txtcari.Text & "%' order by nik asc" KON.Execute (sql1)

ElseIf optnama.Value = True Then

sql1 = "select * from guru where nama_guru like '%" & txtcari.Text & "%' order by nama_guru asc"

KON.Execute (sql1) End If

(21)

21 Private Sub grid_Click()

a = grid.Row

kode = grid.TextMatrix(a, 1) Call koneksi

rsguru.Open "select * from guru ", KON With rsguru

txtnig.Text = kode

guru = "select * from guru where nik='" & txtnig & "'" Set rsguru = KON.Execute(guru)

txtnama.Text = rsguru.Fields("nama_guru") txttempat.Text = rsguru.Fields("tmptlahir_guru")

dttanggal.Value = rsguru.Fields("tgllahir_guru") cmbagama.Text = rsguru.Fields("agama_guru") txtalamat.Text = rsguru.Fields("alamat_guru") If rsguru.Fields("jk_guru") = "Laki-Laki" Then

optlaki.Value = True And optperempuan.Value = False ElseIf rsguru.Fields("jk_guru") = "Perempuan" Then optperempuan.Value = True And optlaki.Value = False End If cmbstatus.Text = rsguru.Fields("status_kawin") cmbpendidikan.Text = rsguru.Fields("pend_guru") txttelp.Text = rsguru.Fields("telp_guru") txtemail.Text = rsguru.Fields("email_guru") cmbjabatan.Text = rsguru.Fields("jbtn_guru") txtpassword.Text = rsguru.Fields("pass_guru") End With

(22)

22 Toolbar1.Buttons(4).Enabled = True

Toolbar1.Buttons(5).Enabled = True End Sub

Private Sub txtalamat_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then

optlaki.SetFocus

txtalamat.Enabled = False End If

End Sub

Private Sub txtcari_Change() Call koneksi

Call tampilguru Call sqlguru End Sub Sub nomor()

Dim trans As String Dim hitung As Integer Call koneksi

rsguru.Open "SELECT * FROM guru ORDER BY nik DESC LIMIT 1;", KON trans = Format(Date, "YYYYMM")

With rsguru If .EOF Then

txtnig.Text = trans + "001" Else

If Format(Date, "YYYY") <> Val(Mid(rsguru!nik, 1, 4)) Then txtnig.Text = Format(Date, "YYYY") + "001"

(23)

23 Else

hitung = Val(Right(rsguru!nik, 3)) + 1

txtnig.Text = Format(Date, "YYYYMM") + Right("000" & hitung, 3) End If

End If End With End Sub

Private Sub txtemail_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then

cmbjabatan.SetFocus txtemail.Enabled = False End If

End Sub

Private Sub txtnama_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then

txttempat.SetFocus txtnama.Enabled = False End If

End Sub

Private Sub txttelp_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then

txtemail.SetFocus txttelp.Enabled = False End If

If Not (KeyAscii >= Asc("0") And KeyAscii <= Asc("9") Or KeyAscii = vbKeyBack) Then KeyAscii = 0

(24)

24 End Sub

Private Sub txttempat_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then

dttanggal.SetFocus

txttempat.Enabled = False End If

(25)

25

B. Data User

Menu ini adalah untuk menambahkan data user yang nantinya akan digunakan untuk login kedalam program.

➢ Klik Add untuk menambahkan data user baru, Id User akan muncul otomatis mengikuti data terakhir yang ada di dalam database, Password terdiri dari 8 digit ➢ Klik Save untuk menyimpan data user baru

➢ Klik Cancel untuk membatalkan proses

➢ Klik baris nama user lalu klik Edit untuk mengubah data user ➢ Klik Delete untuk menghapus data user

➢ Klik Find untuk mencari data user baru maka data di dalam grid hanya akan muncul sesuai dengan data yang dicari saja

➢ Klik Exit untuk keluar dari form data user

Coding Program Data User

Dim tambah As Boolean Sub nonaktif()

(26)

26 Dim kontrol As Control

For Each kontrol In Me.Controls

If TypeOf kontrol Is TextBox Then kontrol.Enabled = False Next cmbstatus.Enabled = False cmdadd.Enabled = True cmdsave.Enabled = False cmdcancel.Enabled = False cmdedit.Enabled = False cmddelete.Enabled = False cmdfind.Enabled = True cmdexit.Enabled = True End Sub Sub aktif()

Dim kontrol As Control

For Each kontrol In Me.Controls

If TypeOf kontrol Is TextBox Then kontrol.Enabled = True Next cmbstatus.Enabled = True cmdadd.Enabled = False cmdsave.Enabled = True cmdcancel.Enabled = True End Sub Sub bersih()

For Each kontrol In Me.Controls

If TypeOf kontrol Is TextBox Then kontrol.Text = "" Next

(27)

27 End Sub

Sub tampilgrid() Call koneksi

rsuser.Open "select * from user", KON Set grid.DataSource = rsuser

grid.ColWidth(0) = 0 grid.ColWidth(1) = 1000 grid.ColWidth(2) = 2500 grid.ColWidth(3) = 1300 grid.ColWidth(4) = 1200

grid.TextMatrix(0, 1) = "Id User" grid.TextMatrix(0, 2) = "Nama User" grid.TextMatrix(0, 3) = "Status User" grid.TextMatrix(0, 4) = "Password" End Sub

Sub simpanuser()

Save = "insert into user values('" & txtid.Text & "','" & txtnama.Text & "','" & cmbstatus.Text & "','" & txtpassword.Text & "')"

KON.Execute Save End Sub

Sub updateuser()

ubah = "update user set nama_user='" & txtnama.Text & "',status_user='" & cmbstatus.Text & "',password_user='" & txtpassword.Text & "' where id_user='" & txtid.Text & "'"

KON.Execute ubah End Sub

Private Sub cmbstatus_Click() txtpassword.SetFocus

(28)

28 cmbstatus.Enabled = False

End Sub

Private Sub cmdadd_Click() aktif

tambah = True

txtcari.Enabled = False txtid.SetFocus

End Sub

Private Sub cmdcancel_Click() Form_Load

End Sub

Private Sub cmddelete_Click() Call koneksi

rsuser.Open "select * from user ", KON With rsuser

If Not (.BOF And .EOF) Then

h = MsgBox("Benar mau dihapus ?", vbQuestion + vbYesNo, "--TaNYa--") If h = vbYes Then

hapus = "delete from user where id_user='" & txtid.Text & "'" KON.Execute (hapus) grid.Refresh Form_Load Else Form_Load End If

(29)

29 End If

End With grid.Refresh End Sub

Private Sub cmdedit_Click() tambah = False aktif txtid.Enabled = False cmbstatus.Enabled = False txtnama.SetFocus cmdcancel.Enabled = True cmdsave.Enabled = True cmdadd.Enabled = False cmdedit.Enabled = False cmddelete.Enabled = False cmdfind.Enabled = False End Sub

Private Sub cmdexit_Click() Unload form_user

menu_utama.Enabled = True menu_utama.Show

End Sub

Private Sub cmdfind_Click() txtcari.Enabled = True txtcari.SetFocus

(30)

30 End Sub

Private Sub cmdsave_Click()

If txtid.Text = "" Or txtnama.Text = "" Or txtpassword.Text = "" Or cmbstatus.Text = "" Then MsgBox "Data Belum Lengkap!!!", vbInformation, "Informasi"

If txtid.Text = "" Then txtid.SetFocus

ElseIf txtnama.Text = "" Then txtnama.SetFocus

ElseIf txtpassword.Text = "" Then txtpassword.SetFocus

ElseIf cmbstatus.Text = "" Then cmbstatus.SetFocus

End If Exit Sub End If

If tambah = True Then simpanuser

grid.Refresh Form_Load

ElseIf tambah = False Then updateuser

grid.Refresh Form_Load End If

End Sub

Private Sub Form_Load() tampilgrid

(31)

31 nonaktif bersih End Sub Sub tampiluser() Call koneksi

rsuser.Open "select * from user where id_user like '%" & txtcari.Text & "%'", KON Set grid.DataSource = rsuser

grid.ColWidth(0) = 0 grid.ColWidth(1) = 1000 grid.ColWidth(2) = 2500 grid.ColWidth(3) = 1200 grid.ColWidth(4) = 1000

grid.TextMatrix(0, 1) = "Id User" grid.TextMatrix(0, 2) = "Nama User" grid.TextMatrix(0, 3) = "Status User" grid.TextMatrix(0, 4) = "Password" End Sub

Sub sqluser()

sql1 = "select * from user where id_user like '%" & txtcari.Text & "%' order by id_user asc" KON.Execute (sql1)

End Sub

Private Sub grid_Click() a = grid.Row

kode = grid.TextMatrix(a, 1) Call koneksi

rsuser.Open "select * from user ", KON With rsuser

(32)

32 txtid.Text = kode

user = "select * from user where id_user='" & txtid & "'" Set rsuser = KON.Execute(user)

txtnama.Text = rsuser.Fields("nama_user") cmbstatus.Text = rsuser.Fields("status_user") txtpassword.Text = rsuser.Fields("password_user") End With cmdedit.Enabled = True cmddelete.Enabled = True End Sub

Private Sub txtcari_Change() Call koneksi

Call tampiluser Call sqluser End Sub

Private Sub txtid_KeyPress(KeyAscii As Integer) Call koneksi

KeyAscii = Asc(UCase(Chr(KeyAscii))) If KeyAscii = 13 Then

rsuser.Open "SELECT * FROM user WHERE id_user='" & txtid & "'", KON With rsuser

If .BOF And .EOF Then

psn = MsgBox("Id " + txtid + " Data Baru", vbInformation, "KONFIRMASI") txtnama = ""

txtpassword = "" cmbstatus.Text = ""

(33)

33 txtid.Enabled = False

txtnama.SetFocus Else

MsgBox "Id User Sudah Ada", vbInformation, "Info" txtid.Text = "" txtid.SetFocus End If End With End If End Sub

Private Sub txtnama_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then

txtnama.Enabled = False cmbstatus.SetFocus End If

End Sub

Private Sub txtpassword_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then

cmdsave.SetFocus

txtpassword.Enabled = False End If

(34)

34

C. Data Kelas

Menu ini adalah untuk menambahkan data kelas yang nantinya akan digunakan untuk proses pengolahan data akademik.

➢ Klik Add untuk menambahkan data kelas baru, Kode Kelas akan muncul otomatis mengikuti data terakhir yang ada di dalam database

➢ Klik Save untuk menyimpan data kelas baru ➢ Klik Cancel untuk membatalkan proses

➢ Klik baris kelas lalu klik Edit untuk mengubah data kelas ➢ Klik Delete untuk menghapus data kelas

➢ Klik Find untuk mencari data kelas maka data di dalam grid hanya akan muncul sesuai dengan data yang dicari saja

➢ Klik Exit untuk keluar dari form data kelas

Coding Program Data Kelas

Dim tambah As Boolean Sub isicmbnig()

Call koneksi

(35)

35 cmbnik.Clear

Do While Not rsguru.EOF cmbnik.AddItem rsguru!nik rsguru.MoveNext

Loop End Sub Sub nonaktif()

Dim kontrol As Control

For Each kontrol In Me.Controls

If TypeOf kontrol Is TextBox Then kontrol.Enabled = False Next Toolbar1.Buttons(1).Enabled = True Toolbar1.Buttons(2).Enabled = False Toolbar1.Buttons(3).Enabled = False Toolbar1.Buttons(4).Enabled = False Toolbar1.Buttons(5).Enabled = False Toolbar1.Buttons(6).Enabled = True Toolbar1.Buttons(7).Enabled = True cmbstatus.Enabled = False cmbjurusan.Enabled = False cmbnik.Enabled = False End Sub Sub aktif()

Dim kontrol As Control

For Each kontrol In Me.Controls

If TypeOf kontrol Is TextBox Then kontrol.Enabled = True Next

(36)

36 Toolbar1.Buttons(2).Enabled = True Toolbar1.Buttons(3).Enabled = True Toolbar1.Buttons(4).Enabled = False Toolbar1.Buttons(5).Enabled = False Toolbar1.Buttons(6).Enabled = False Toolbar1.Buttons(7).Enabled = True cmbstatus.Enabled = True cmbjurusan.Enabled = True cmbnik.Enabled = True End Sub Sub bersih()

For Each kontrol In Me.Controls

If TypeOf kontrol Is TextBox Then kontrol.Text = "" Next

cmbstatus = "Status Kelas" cmbjurusan.Text = "Jurusan" cmbnik.Text = "Wali Kelas" End Sub

Sub tampilgrid() Call koneksi

rskelas.Open "select * from kelas", KON Set grid.DataSource = rskelas

aturgrid End Sub

Sub simpankelas() Dim a As String

Save = "insert into kelas values('" & txtkode.Text & "','" & txtkelas.Text & "','" & txtmax.Text & "','" & cmbstatus.Text & "','" & cmbnik.Text & "','" & cmbjurusan.Text & "')"

(37)

37 End Sub

Sub updatekelas()

ubah = "update kelas set nik='" & cmbnik.Text & "',max_siswa='" & txtmax.Text & "',status_kelas='" & cmbstatus.Text & "' where id_kelas='" & txtkode.Text & "'" KON.Execute ubah

End Sub

Private Sub cmbjurusan_keypress(KeyAscii As Integer)

If Not (KeyAscii >= Asc("0") And KeyAscii <= Asc("9") And (KeyAscii >= Asc("a") And KeyAscii <= Asc("z") And KeyAscii = 46 And KeyAscii = 127 Or KeyAscii = vbKeyBack)) Then KeyAscii = 0

End Sub

Private Sub cmbnik_Click() Call koneksi

rskelas.Open "select * from kelas where nik='" & cmbnik.Text & "'", KON With rskelas

If .BOF And .EOF Then Exit Sub

Else

MsgBox "Guru sudah menjadi wali kelas!!", vbInformation, "Informasi" cmbnik.Text = ""

cmbnik.SetFocus End If

End With End Sub

(38)

38

If Not (KeyAscii >= Asc("0") And KeyAscii <= Asc("9") And (KeyAscii >= Asc("a") And KeyAscii <= Asc("z") And KeyAscii = 46 And KeyAscii = 127 Or KeyAscii = vbKeyBack)) Then KeyAscii = 0

End Sub

Private Sub cmbstatus_KeyPress(KeyAscii As Integer)

If Not (KeyAscii >= Asc("0") And KeyAscii <= Asc("9") And (KeyAscii >= Asc("a") And KeyAscii <= Asc("z") And KeyAscii = 46 And KeyAscii = 127 Or KeyAscii = vbKeyBack)) Then KeyAscii = 0

End Sub

Sub isicmbjurusan() Call koneksi

rsjurusan.Open "select * from jurusan", KON cmbjurusan.Clear

Do While Not rsjurusan.EOF

cmbjurusan.AddItem rsjurusan!kode_jurusan rsjurusan.MoveNext

Loop End Sub

Private Sub Form_Load() tampilgrid isicmbjurusan nonaktif bersih isicmbnig End Sub

Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button) If Button.Index = 1 Then

(39)

39 bersih

tambah = True txtkode.SetFocus

ElseIf Button.Index = 2 Then

If txtkode.Text = "" Or txtkelas.Text = "" Or txtmax.Text = "" Or cmbstatus = "" Or cmbnik.Text = "" Or cmbjurusan.Text = "" Then

MsgBox "Silahkan Lengkapi Data!!", vbInformation, "Informasi" If cmbjurusan.Text = "" Then

cmbjurusan.SetFocus ElseIf txtkode.Text = "" Then txtkode.SetFocus

ElseIf txtkelas.Text = "" Then txtkelas.SetFocus

ElseIf txtmax.Text = "" Then txtmax.SetFocus

ElseIf cmbstatus.Text = "" Then cmbstatus.SetFocus

ElseIf cmbnik.Text = "" Then cmbnik.SetFocus

End If Exit Sub End If

If tambah = True Then simpankelas

grid.Refresh Form_Load

ElseIf tambah = False Then updatekelas

(40)

40 Form_Load

End If

ElseIf Button.Index = 3 Then Form_Load

ElseIf Button.Index = 4 Then tambah = False aktif txtkode.Enabled = False txtkelas.SetFocus Toolbar1.Buttons(3).Enabled = True Toolbar1.Buttons(2).Enabled = True Toolbar1.Buttons(1).Enabled = False Toolbar1.Buttons(4).Enabled = False Toolbar1.Buttons(5).Enabled = False Toolbar1.Buttons(6).Enabled = False ElseIf Button.Index = 5 Then

Call koneksi

rskelas.Open "select * from kelas ", KON With rskelas

If Not (.BOF And .EOF) Then

h = MsgBox("Hapus Data Kelas ?", vbQuestion + vbYesNo, "Konfirmasi") If h = vbYes Then

hapus = "delete from kelas where id_kelas='" & txtkode.Text & "'" KON.Execute (hapus)

grid.Refresh Form_Load Else

(41)

41 End If

End If End With grid.Refresh

ElseIf Button.Index = 6 Then txtcari.Enabled = True txtcari.SetFocus

ElseIf Button.Index = 7 Then Unload data_kelas menu_utama.Enabled = True menu_utama.Show End If End Sub Sub aturgrid() grid.ColWidth(0) = 0 grid.ColWidth(1) = 1250 grid.ColWidth(2) = 1750 grid.ColWidth(3) = 1200 grid.ColWidth(4) = 1500 grid.ColWidth(5) = 1200 grid.ColWidth(6) = 1500

grid.TextMatrix(0, 1) = "Id Kelas" grid.TextMatrix(0, 2) = "Kelas" grid.TextMatrix(0, 3) = "Max Siswa" grid.TextMatrix(0, 4) = "Status Kelas" grid.TextMatrix(0, 5) = "Wali Kelas" grid.TextMatrix(0, 6) = "Jurusan" End Sub

(42)

42 Sub tampilkelas()

Call koneksi

rskelas.Open "select * from kelas where id_kelas like '%" & txtcari.Text & "%'", KON Set grid.DataSource = rskelas

aturgrid End Sub Sub sqlkelas()

sql1 = "select * from kelas where id_kelas like '%" & txtcari.Text & "%' order by id_kelas asc" KON.Execute (sql1)

End Sub

Private Sub grid_Click() a = grid.Row

kode = grid.TextMatrix(a, 1) Call koneksi

rskelas.Open "select * from kelas ", KON With rskelas

txtkode.Text = kode

kelas = "select * from kelas where id_kelas='" & txtkode & "'" Set rskelas = KON.Execute(kelas)

txtkelas.Text = rskelas.Fields("kelas") txtmax.Text = rskelas.Fields("max_siswa") cmbstatus.Text = rskelas.Fields("status_kelas") cmbjurusan.Text = rskelas.Fields("kode_jurusan") cmbnik.Text = rskelas.Fields("nik") Toolbar1.Buttons(4).Enabled = True Toolbar1.Buttons(5).Enabled = True End With

(43)

43 End Sub

Private Sub txtkode_KeyPress(KeyAscii As Integer) Call koneksi

KeyAscii = Asc(UCase(Chr(KeyAscii))) If KeyAscii = 13 Then

rskelas.Open "SELECT * FROM kelas WHERE id_kelas='" & txtkode & "'", KON With rskelas

If .BOF And .EOF Then

psn = MsgBox("Kode kelas " + txtkode + " Data Baru", vbInformation, "KONFIRMASI") txtkelas = ""

txtmax.Text = "" cmbstatus = "" txtkelas.SetFocus Else

MsgBox "Kode kelas Sudah Ada", vbInformation, "Info" txtkode.Text = "" txtkode.SetFocus End If End With End If End Sub

Private Sub txtnama_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then

cmbstatus.SetFocus txtnama.Enabled = False End If

(44)

44 End Sub

Private Sub txtcari_Change() Call koneksi

Call tampilkelas Call sqlkelas End Sub

(45)

45

D. Data Pelajaran

Menu ini adalah untuk menambahkan data pelajaran yang nantinya akan digunakan untuk proses pengolahan data akademik.

➢ Klik Add untuk menambahkan data pelajaran baru. ➢ Klik Save untuk menyimpan data pelajaran baru ➢ Klik Cancel untuk membatalkan proses

➢ Klik baris pelajaran lalu klik Edit untuk mengubah data pelajaran ➢ Klik Delete untuk menghapus data pelajaran

➢ Klik Find untuk mencari data pelajaran maka data di dalam grid hanya akan muncul sesuai dengan data yang dicari saja

➢ Klik Exit untuk keluar dari form data pelajaran

Coding Program Data Pelajaran

Dim tambah As Boolean Sub nonaktif()

Dim kontrol As Control

(46)

46

If TypeOf kontrol Is TextBox Then kontrol.Enabled = False Next Toolbar1.Buttons(1).Enabled = True Toolbar1.Buttons(2).Enabled = False Toolbar1.Buttons(3).Enabled = False Toolbar1.Buttons(4).Enabled = False Toolbar1.Buttons(5).Enabled = False Toolbar1.Buttons(6).Enabled = True Toolbar1.Buttons(7).Enabled = True cmbjenis.Enabled = False End Sub Sub aktif()

Dim kontrol As Control

For Each kontrol In Me.Controls

If TypeOf kontrol Is TextBox Then kontrol.Enabled = True Next Toolbar1.Buttons(1).Enabled = False Toolbar1.Buttons(2).Enabled = True Toolbar1.Buttons(3).Enabled = True Toolbar1.Buttons(4).Enabled = False Toolbar1.Buttons(5).Enabled = False Toolbar1.Buttons(6).Enabled = False Toolbar1.Buttons(7).Enabled = True cmbjenis.Enabled = True End Sub Sub bersih()

For Each kontrol In Me.Controls

(47)

47 Next

cmbjenis = "Pilih Jenis" End Sub

Sub tampilgrid() Call koneksi

rsmatpel.Open "select * from matpel", KON Set grid.DataSource = rsmatpel

aturgrid End Sub

Sub simpanmatpel() Dim a As String

Save = "insert into matpel values('" & txtkode.Text & "','" & txtnama.Text & "','" & cmbjenis.Text & "')"

KON.Execute Save End Sub

Sub updatematpel()

ubah = "update matpel set nama_matpel='" & txtnama.Text & "',jenis_matpel='" & cmbjenis.Text & "' where kode_matpel='" & txtkode.Text & "'"

KON.Execute ubah End Sub

Private Sub cmbjenis_KeyPress(KeyAscii As Integer)

If Not (KeyAscii >= Asc("0") And KeyAscii <= Asc("9") And (KeyAscii >= Asc("a") And KeyAscii <= Asc("z") And KeyAscii = 46 Or KeyAscii = vbKeyBack)) Then KeyAscii = 0 End Sub

Private Sub Form_Load() tampilgrid

nonaktif bersih

(48)

48 End Sub

Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button) If Button.Index = 1 Then

aktif bersih

tambah = True txtkode.SetFocus

ElseIf Button.Index = 2 Then

If txtkode.Text = "" Or txtnama.Text = "" Or cmbjenis = "" Then MsgBox "Silahkan Lengkapi Data!!", vbInformation, "Informasi" If txtkode.Text = "" Then

txtkode.SetFocus

ElseIf txtnama.Text = "" Then txtnama.SetFocus

ElseIf cmbjenis.Text = "" Then cmbjenis.SetFocus

End If Exit Sub End If

If tambah = True Then simpanmatpel grid.Refresh Form_Load

ElseIf tambah = False Then updatematpel

grid.Refresh Form_Load

(49)

49 End If

ElseIf Button.Index = 3 Then Form_Load

ElseIf Button.Index = 4 Then tambah = False aktif txtkode.Enabled = False txtnama.SetFocus Toolbar1.Buttons(3).Enabled = True Toolbar1.Buttons(2).Enabled = True Toolbar1.Buttons(1).Enabled = False Toolbar1.Buttons(4).Enabled = False Toolbar1.Buttons(5).Enabled = False Toolbar1.Buttons(6).Enabled = False ElseIf Button.Index = 5 Then

Call koneksi

rsmatpel.Open "select * from matpel ", KON With rsmatpel

If Not (.BOF And .EOF) Then

h = MsgBox("Hapus Data Pelajaran ?", vbQuestion + vbYesNo, "Konfirmasi") If h = vbYes Then

hapus = "delete from matpel where kode_matpel='" & txtkode.Text & "'" KON.Execute (hapus) grid.Refresh Form_Load Else Form_Load End If

(50)

50 End If

End With grid.Refresh

ElseIf Button.Index = 6 Then txtcari.Enabled = True txtcari.SetFocus

ElseIf Button.Index = 7 Then Unload data_matpel menu_utama.Enabled = True menu_utama.Show End If End Sub Sub aturgrid() grid.ColWidth(0) = 0 grid.ColWidth(1) = 2000 grid.ColWidth(2) = 2500 grid.ColWidth(3) = 2000

grid.TextMatrix(0, 1) = "Kode Matpel" grid.TextMatrix(0, 2) = "Nama Matpel" grid.TextMatrix(0, 3) = "Jenis Matpel" End Sub

Sub tampilmatpel() Call koneksi

rsmatpel.Open "select * from matpel where nama_matpel like '%" & txtcari.Text & "%'", KON Set grid.DataSource = rsmatpel

aturgrid End Sub

(51)

51

sql1 = "select * from matpel where nama_matpel like '%" & txtcari.Text & "%' order by nama_matpel asc"

KON.Execute (sql1) End Sub

Private Sub grid_dblClick() a = grid.Row

kode = grid.TextMatrix(a, 1) Call koneksi

rsmatpel.Open "select * from matpel ", KON With rsmatpel

txtkode.Text = kode

matpel = "select * from matpel where kode_matpel='" & txtkode & "'" Set rsmatpel = KON.Execute(matpel)

txtnama.Text = rsmatpel.Fields("nama_matpel") cmbjenis.Text = rsmatpel.Fields("jenis_matpel") Toolbar1.Buttons(4).Enabled = True Toolbar1.Buttons(5).Enabled = True End With End Sub

Private Sub txtkode_KeyPress(KeyAscii As Integer) Call koneksi

KeyAscii = Asc(UCase(Chr(KeyAscii))) If KeyAscii = 13 Then

rsmatpel.Open "SELECT * FROM matpel WHERE kode_matpel='" & txtkode & "'", KON With rsmatpel

If .BOF And .EOF Then

(52)

52 txtnama = ""

cmbjenis = "" txtnama.SetFocus Else

MsgBox "Kode Matpel Sudah Ada", vbInformation, "Info" txtkode.Text = "" txtkode.SetFocus End If End With End If End Sub

Private Sub txtnama_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then

cmbjenis.SetFocus txtnama.Enabled = False End If

End Sub

Private Sub txtcari_Change() Call koneksi

Call tampilmatpel Call sqlmatpel End Sub

(53)

53

E. Data Jadwal

Menu ini adalah untuk menambahkan data jadwal yang nantinya akan digunakan untuk proses pengolahan data akademik.

➢ Klik Add untuk menambahkan data jadwal baru. ➢ Klik Save untuk menyimpan data jadwal baru ➢ Klik Cancel untuk membatalkan proses

➢ Klik baris jadwal lalu klik Edit untuk mengubah data jadwal ➢ Klik Delete untuk menghapus data jadwal

➢ Klik Find untuk mencari data jadwal maka data di dalam grid hanya akan muncul sesuai dengan data yang dicari saja

➢ Klik Close untuk keluar dari form data jadwal

Coding Program Data Jadwal

Dim tambah As Boolean Sub isicmbnig()

(54)

54 rsguru.Open "select * from guru", KON

cmbnig.Clear

Do While Not rsguru.EOF cmbnig.AddItem rsguru!nik rsguru.MoveNext Loop End Sub Sub isicmbkelas() Call koneksi

rskelas.Open "select * from kelas", KON cmbkelas.Clear

Do While Not rskelas.EOF

cmbkelas.AddItem rskelas!id_kelas rskelas.MoveNext Loop End Sub Sub isicmbmatpel() Call koneksi

rsmatpel.Open "select * from matpel", KON cmbmatpel.Clear

Do While Not rsmatpel.EOF

cmbmatpel.AddItem rsmatpel!kode_matpel rsmatpel.MoveNext

Loop End Sub

Private Sub cmbmasuk_Click() Call koneksi

(55)

55 rsjadwal.Open "select * from jadwal where ", KON

End Sub

Private Sub Form_Load() isicmbnig isicmbkelas isicmbmatpel nonaktif bersih tampilgrid End Sub Sub nonaktif()

Dim kontrol As Control

For Each kontrol In Me.Controls

If TypeOf kontrol Is TextBox Then kontrol.Enabled = False Next Toolbar1.Buttons(1).Enabled = True Toolbar1.Buttons(2).Enabled = False Toolbar1.Buttons(3).Enabled = False Toolbar1.Buttons(4).Enabled = False Toolbar1.Buttons(5).Enabled = False Toolbar1.Buttons(6).Enabled = True Toolbar1.Buttons(7).Enabled = True optnig.Enabled = False optkelas.Enabled = False optmatpel.Enabled = False cmbkelas.Enabled = False

(56)

56 cmbmatpel.Enabled = False cmbnig.Enabled = False cmbmasuk.Enabled = False cmbkeluar.Enabled = False cmbhari.Enabled = False End Sub Sub aktif()

Dim kontrol As Control

For Each kontrol In Me.Controls

If TypeOf kontrol Is TextBox Then kontrol.Enabled = True Next Toolbar1.Buttons(1).Enabled = False Toolbar1.Buttons(2).Enabled = True Toolbar1.Buttons(3).Enabled = True Toolbar1.Buttons(4).Enabled = False Toolbar1.Buttons(5).Enabled = False Toolbar1.Buttons(6).Enabled = False Toolbar1.Buttons(7).Enabled = True cmbkelas.Enabled = True cmbmatpel.Enabled = True cmbnig.Enabled = True cmbmasuk.Enabled = True cmbkeluar.Enabled = True cmbhari.Enabled = True End Sub Sub bersih()

For Each kontrol In Me.Controls

(57)

57 Next

cmbkelas.Text = "Pilih Kelas" cmbmatpel.Text = "Pilih Matpel" cmbnig.Text = "Pilih NIG" cmbmasuk.Text = "Pilih Jam" cmbkeluar.Text = "Pilih Jam" cmbhari.Text = "Pilih Hari" optnig.Value = False optkelas.Value = False optmatpel.Value = False End Sub Sub tampilgrid() Call koneksi

rsjadwal.Open "select * from jadwal", KON Set grid.DataSource = rsjadwal

aturgrid End Sub Sub aturgrid() grid.ColWidth(0) = 0 grid.ColWidth(1) = 500 grid.ColWidth(2) = 1300 grid.ColWidth(3) = 1300 grid.ColWidth(4) = 1300 grid.ColWidth(5) = 1300 grid.ColWidth(6) = 1300 grid.ColWidth(7) = 1300

grid.TextMatrix(0, 1) = "Id Jadwal" grid.TextMatrix(0, 2) = "Id Kelas"

(58)

58 grid.TextMatrix(0, 3) = "Kode Matpel"

grid.TextMatrix(0, 4) = "Nik"

grid.TextMatrix(0, 5) = "Jam Masuk" grid.TextMatrix(0, 6) = "Jam Keluar" grid.TextMatrix(0, 7) = "Hari Masuk" End Sub

Sub simpanjadwal() Dim a As String

Save = "insert into jadwal values('" & txtid.Text & "','" & cmbkelas.Text & "','" &

cmbmatpel.Text & "','" & cmbnig.Text & "','" & cmbmasuk.Text & "','" & cmbkeluar.Text & "','" & cmbhari.Text & "')"

KON.Execute Save End Sub

Sub updatejadwal()

ubah = "update jadwal set id_kelas='" & cmbkelas.Text & "',kode_matpel='" & cmbmatpel.Text & "',nik='" & cmbnig.Text & "',jam_masuk='" & cmbmasuk.Text & "',jam_keluar='" &

cmbkeluar.Text & "',hari_masuk='" & cmbhari.Text & "' where id_jadwal='" & txtid.Text & "'" KON.Execute ubah

End Sub

Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button) If Button.Index = 1 Then aktif bersih tambah = True nomor cmbkelas.Enabled = True cmbkelas.SetFocus

(59)

59

If txtid.Text = "" Or cmbkelas.Text = "" Or cmbmatpel = "" Or cmbnig = "" Or cmbmasuk = "" Or cmbkeluar = "" Or cmbhari = "" Then

MsgBox "Silahkan Lengkapi Data!!", vbInformation, "Informasi" If txtid.Text = "" Then

txtid.SetFocus

ElseIf cmbkelas.Text = "" Then cmbkelas.SetFocus

ElseIf cmbmatpel.Text = "" Then cmbmatpel.SetFocus

ElseIf cmbnig.Text = "" Then cmbnig.SetFocus

ElseIf cmbmasuk.Text = "" Then cmbmasuk.SetFocus

ElseIf cmbkeluar.Text = "" Then cmbkeluar.SetFocus

ElseIf cmbhari.Text = "" Then cmbhari.SetFocus

End If Exit Sub End If

If tambah = True Then simpanjadwal grid.Refresh Form_Load

ElseIf tambah = False Then updatejadwal

grid.Refresh Form_Load End If

(60)

60 ElseIf Button.Index = 3 Then

Form_Load

ElseIf Button.Index = 4 Then tambah = False aktif txtid.Enabled = False cmbkelas.SetFocus Toolbar1.Buttons(3).Enabled = True Toolbar1.Buttons(2).Enabled = True Toolbar1.Buttons(1).Enabled = False Toolbar1.Buttons(4).Enabled = False Toolbar1.Buttons(5).Enabled = False Toolbar1.Buttons(6).Enabled = False ElseIf Button.Index = 5 Then

Call koneksi

rsjadwal.Open "select * from jadwal ", KON With rsjadwal

If Not (.BOF And .EOF) Then

h = MsgBox("Hapus Data Jadwal ?", vbQuestion + vbYesNo, "Konfirmasi") If h = vbYes Then

hapus = "delete from jadwal where id_jadwal='" & txtid.Text & "'" KON.Execute (hapus) grid.Refresh Form_Load Else Form_Load End If End If

(61)

61 End With

grid.Refresh

ElseIf Button.Index = 6 Then optnig.Enabled = True optkelas.Enabled = True optmatpel.Enabled = True txtcari.Enabled = True txtcari.SetFocus

ElseIf Button.Index = 7 Then Unload form_jadwal menu_utama.Enabled = True menu_utama.Show End If End Sub Sub tampiljadwal() Call koneksi

If optnig.Value = True Then

rsjadwal.Open "select * from jadwal where nik like '%" & txtcari.Text & "%'", KON Set grid.DataSource = rsjadwal

aturgrid

ElseIf optmatpel.Value = True Then

rsjadwal.Open "select * from jadwal where kode_matpel like '%" & txtcari.Text & "%'", KON Set grid.DataSource = rsjadwal

aturgrid '

ElseIf optkelas.Value = True Then

rsjadwal.Open "select * from jadwal where id_kelas like '%" & txtcari.Text & "%'", KON Set grid.DataSource = rsjadwal

(62)

62 aturgrid '

End If End Sub

Sub sqljadwal()

If optnig.Value = True Then

sql1 = "select * from jadwal where nik like '%" & txtcari.Text & "%' order by nik asc" KON.Execute (sql1)

ElseIf optmatpel.Value = True Then

sql1 = "select * from jadwal where kode_matpel like '%" & txtcari.Text & "%' order by kode_matpel asc"

KON.Execute (sql1)

ElseIf optkelas.Value = True Then

sql1 = "select * from jadwal where id_kelas like '%" & txtcari.Text & "%' order by id_kelas asc"

KON.Execute (sql1) End If

End Sub

Private Sub grid_Click() a = grid.Row

kode = grid.TextMatrix(a, 1) Call koneksi

rsjadwal.Open "select * from jadwal ", KON With rsjadwal

txtid.Text = kode

jadwal = "select * from jadwal where id_jadwal='" & txtid & "'" Set rsjadwal = KON.Execute(jadwal)

cmbkelas.Text = rsjadwal.Fields("id_kelas") cmbmatpel.Text = rsjadwal.Fields("kode_matpel")

(63)

63 cmbnig.Text = rsjadwal.Fields("nik") cmbmasuk.Text = rsjadwal.Fields("jam_masuk") cmbkeluar.Text = rsjadwal.Fields("jam_keluar") cmbhari.Text = rsjadwal.Fields("hari_masuk") Toolbar1.Buttons(4).Enabled = True Toolbar1.Buttons(5).Enabled = True End With End Sub

Private Sub txtcari_Change() Call koneksi

Call tampiljadwal Call sqljadwal End Sub Sub nomor()

Dim trans As String Dim hitung As Integer Call koneksi

rsjadwal.Open "SELECT * FROM jadwal ORDER BY id_jadwal DESC LIMIT 1;", KON With rsjadwal

If .EOF Then

txtid.Text = "001" Else

hitung = Val(Right(rsjadwal!id_jadwal, 3)) + 1 txtid.Text = Right("000" & hitung, 3)

End If End With End Sub

(64)

64

F. Data Jurusan

Menu ini adalah untuk menambahkan data jurusan yang nantinya akan digunakan untuk proses pengolahan data akademik.

➢ Klik Add untuk menambahkan data jurusan baru. ➢ Klik Save untuk menyimpan data jurusan baru ➢ Klik Cancel untuk membatalkan proses

➢ Klik baris jurusan lalu klik Edit untuk mengubah data jurusan ➢ Klik Delete untuk menghapus data jurusan

➢ Klik Find untuk mencari data jurusan maka data di dalam grid hanya akan muncul sesuai dengan data yang dicari saja

➢ Klik Close untuk keluar dari form data jurusan

Coding Program Data Jurusan

Dim tambah As Boolean Sub nonaktif()

Dim kontrol As Control

For Each kontrol In Me.Controls

If TypeOf kontrol Is TextBox Then kontrol.Enabled = False Next

(65)

65 Toolbar1.Buttons(2).Enabled = False Toolbar1.Buttons(3).Enabled = False Toolbar1.Buttons(4).Enabled = False Toolbar1.Buttons(5).Enabled = False Toolbar1.Buttons(6).Enabled = True Toolbar1.Buttons(7).Enabled = True End Sub Sub aktif()

Dim kontrol As Control

For Each kontrol In Me.Controls

If TypeOf kontrol Is TextBox Then kontrol.Enabled = True Next Toolbar1.Buttons(1).Enabled = False Toolbar1.Buttons(2).Enabled = True Toolbar1.Buttons(3).Enabled = True Toolbar1.Buttons(4).Enabled = False Toolbar1.Buttons(5).Enabled = False Toolbar1.Buttons(6).Enabled = False Toolbar1.Buttons(7).Enabled = True End Sub Sub bersih()

For Each kontrol In Me.Controls

If TypeOf kontrol Is TextBox Then kontrol.Text = "" Next

End Sub

Sub tampilgrid() Call koneksi

(66)

66 Set grid.DataSource = rsjurusan

aturgrid End Sub

Sub simpanjurusan() Dim a As String

Save = "insert into jurusan values('" & txtkode.Text & "','" & txtnama.Text & "')" KON.Execute Save

End Sub

Sub updatejurusan()

ubah = "update jurusan set nama_jurusan='" & txtnama.Text & "' where kode_jurusan='" & txtkode.Text & "'"

KON.Execute ubah End Sub

Private Sub Form_Load() tampilgrid

nonaktif bersih End Sub

Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button) If Button.Index = 1 Then

aktif bersih

tambah = True txtkode.SetFocus

ElseIf Button.Index = 2 Then

If txtkode.Text = "" Or txtnama.Text = "" Then

MsgBox "Silahkan Lengkapi Data!!", vbInformation, "Informasi" If txtkode.Text = "" Then

(67)

67 ElseIf txtnama.Text = "" Then

txtnama.SetFocus End If

Exit Sub End If

If tambah = True Then simpanjurusan grid.Refresh Form_Load

ElseIf tambah = False Then updatejurusan

grid.Refresh Form_Load End If

ElseIf Button.Index = 3 Then Form_Load

ElseIf Button.Index = 4 Then tambah = False aktif txtkode.Enabled = False txtnama.SetFocus Toolbar1.Buttons(3).Enabled = True Toolbar1.Buttons(2).Enabled = True Toolbar1.Buttons(1).Enabled = False Toolbar1.Buttons(4).Enabled = False Toolbar1.Buttons(5).Enabled = False Toolbar1.Buttons(6).Enabled = False ElseIf Button.Index = 5 Then

(68)

68 Call koneksi

rsjurusan.Open "select * from jurusan ", KON With rsjurusan

If Not (.BOF And .EOF) Then

h = MsgBox("Hapus Data Jurusan ?", vbQuestion + vbYesNo, "Konfirmasi") If h = vbYes Then

hapus = "delete from jurusan where kode_jurusan='" & txtkode.Text & "'" KON.Execute (hapus) grid.Refresh Form_Load Else Form_Load End If End If End With grid.Refresh

ElseIf Button.Index = 6 Then txtcari.Enabled = True txtcari.SetFocus

ElseIf Button.Index = 7 Then Unload data_jurusan menu_utama.Enabled = True menu_utama.Show End If End Sub Sub aturgrid() grid.ColWidth(0) = 0 grid.ColWidth(1) = 1000

(69)

69 grid.ColWidth(2) = 3200

grid.TextMatrix(0, 1) = "Kode Jurusan" grid.TextMatrix(0, 2) = "Nama Jurusan" End Sub

Sub tampiljurusan() Call koneksi

rsjurusan.Open "select * from jurusan where nama_jurusan like '%" & txtcari.Text & "%'", KON Set grid.DataSource = rsjurusan

aturgrid End Sub

Sub sqljurusan()

sql1 = "select * from jurusan where nama_jurusan like '%" & txtcari.Text & "%' order by nama_jurusan asc"

KON.Execute (sql1) End Sub

Private Sub grid_dblClick() a = grid.Row

kode = grid.TextMatrix(a, 1) Call koneksi

rsjurusan.Open "select * from jurusan ", KON With rsjurusan

txtkode.Text = kode

jurusan = "select * from jurusan where kode_jurusan='" & txtkode & "'" Set rsjurusan = KON.Execute(jurusan)

txtnama.Text = rsjurusan.Fields("nama_jurusan") Toolbar1.Buttons(4).Enabled = True

Toolbar1.Buttons(5).Enabled = True End With

(70)

70 End Sub

Private Sub txtkode_KeyPress(KeyAscii As Integer) Call koneksi

KeyAscii = Asc(UCase(Chr(KeyAscii))) If KeyAscii = 13 Then

rsjurusan.Open "SELECT * FROM jurusan WHERE kode_jurusan='" & txtkode & "'", KON With rsjurusan

If .BOF And .EOF Then

psn = MsgBox("Kode jurusan " + txtkode + " Data Baru", vbInformation, "KONFIRMASI") txtnama = ""

cmbjenis = "" txtnama.SetFocus Else

MsgBox "Kode jurusan Sudah Ada", vbInformation, "Info" txtkode.Text = "" txtkode.SetFocus End If End With End If End Sub

Private Sub txtcari_Change() Call koneksi

Call tampiljurusan Call sqljurusan End Sub

(71)

71

G. Data Siswa

Menu ini adalah untuk menambahkan data siswa yang nantinya akan digunakan untuk proses pengolahan data akademik.

➢ Klik Add untuk menambahkan data siswa baru. ➢ Klik Save untuk menyimpan data siswa baru ➢ Klik Cancel untuk membatalkan proses

➢ Klik baris siswa lalu klik Edit untuk mengubah data siswa ➢ Klik Delete untuk menghapus data siswa

➢ Klik Find untuk mencari data siswa maka data di dalam grid hanya akan muncul sesuai dengan data yang dicari saja

➢ Klik Exit untuk keluar dari form data siswa

Coding Program Data Siswa

Dim tambah, a, b As Boolean Sub nonaktif()

Dim kontrol As Control

For Each kontrol In Me.Controls

If TypeOf kontrol Is TextBox Then kontrol.Enabled = False Next

(72)

72 Toolbar1.Buttons(1).Enabled = True Toolbar1.Buttons(2).Enabled = False Toolbar1.Buttons(3).Enabled = False Toolbar1.Buttons(4).Enabled = False Toolbar1.Buttons(5).Enabled = False Toolbar1.Buttons(6).Enabled = True Toolbar1.Buttons(7).Enabled = True dttanggal.Enabled = False cmbagama.Enabled = False optlaki.Enabled = False optperempuan.Enabled = False cmbkelas.Enabled = False cmbjurusan.Enabled = False optnis.Enabled = False optnama.Enabled = False cmbkondisi.Enabled = False End Sub Sub aktif()

Dim kontrol As Control

For Each kontrol In Me.Controls

If TypeOf kontrol Is TextBox Then kontrol.Enabled = True Next Toolbar1.Buttons(1).Enabled = False Toolbar1.Buttons(2).Enabled = True Toolbar1.Buttons(3).Enabled = True Toolbar1.Buttons(4).Enabled = False Toolbar1.Buttons(5).Enabled = False Toolbar1.Buttons(6).Enabled = False

(73)

73 Toolbar1.Buttons(7).Enabled = True dttanggal.Enabled = True cmbagama.Enabled = True optlaki.Enabled = True optperempuan.Enabled = True cmbkelas.Enabled = True cmbjurusan.Enabled = True optnis.Enabled = False optnama.Enabled = False cmbkondisi.Enabled = True End Sub Sub bersih()

Dim kontrol As Control

For Each kontrol In Me.Controls

If TypeOf kontrol Is TextBox Then kontrol.Text = "" Next

cmbagama.Text = "Pilih Agama" optlaki.Value = False

optperempuan.Value = False cmbkelas.Text = "Pilih Kelas" cmbjurusan.Text = "Pilih jurusan" optnis.Value = False

optnama.Value = False

cmbkondisi.Text = "Pilih Kondisi" End Sub

Sub tampilgrid() Call koneksi

(74)

74 Set grid.DataSource = rssiswa

aturgrid End Sub

Sub simpansiswa()

c = Format(Me.dttanggal.Value, "YYYY/MM/DD") If optlaki.Value = True Then

Savelaki = "insert into siswa values('" & txtnis.Text & "','" & txtnama.Text & "','" & c & "','" & optlaki.Caption & "','" & cmbagama.Text & "','" & txttempat.Text & "','" & txtalamat.Text & "','" & txttelp.Text & "','" & txtemail.Text & "','" & txtasal.Text & "','" & txttahun.Text & "','" & cmbkondisi.Text & "','" & txtwali.Text & "','" & cmbkelas.Text & "','" & cmbjurusan.Text & "')" KON.Execute Savelaki

ElseIf optperempuan.Value = True Then

Savecewe = "insert into siswa values('" & txtnis.Text & "','" & txtnama.Text & "','" & c & "','" & optperempuan.Caption & "','" & cmbagama.Text & "','" & txttempat.Text & "','" &

txtalamat.Text & "','" & txttelp.Text & "','" & txtemail.Text & "','" & txtasal.Text & "','" & txttahun.Text & "','" & cmbkondisi.Text & "','" & txtwali.Text & "','" & cmbkelas.Text & "','" & cmbjurusan.Text & "')" KON.Execute Savecewe End If End Sub Sub updatesiswa() a = Format(Me.dttanggal.Value, "YYYY/MM/DD")

ubah = "update siswa set nama_siswa='" & txtnama.Text & "',bd_siswa='" & a &

"',agm_siswa='" & cmbagama.Text & "',tempat_lahir='" & txttempat.Text & "',almt_siswa='" & txtalamat.Text & "',telp_siswa='" & txttelp.Text & "',email_siswa='" & txtemail.Text &

"',asal_sekolah='" & txtasal.Text & "',masuk_siswa='" & txttahun.Text & "',kondisi='" & cmbkondisi.Text & "',nama_wali='" & txtwali.Text & "',id_kelas='" & cmbkelas.Text & "',kode_jurusan='" & cmbjurusan.Text & "' where nis='" & txtnis.Text & "'"

KON.Execute ubah End Sub

Private Sub cmbagama_KeyPress(KeyAscii As Integer)

If Not (KeyAscii >= Asc("0") And KeyAscii <= Asc("9") And (KeyAscii >= Asc("a") And KeyAscii <= Asc("z") And KeyAscii = 46 Or KeyAscii = vbKeyBack)) Then KeyAscii = 0

(75)

75 End Sub

Private Sub cmbjurusan_Click() isicmbkelas

End Sub

Private Sub cmbkondisi_KeyPress(KeyAscii As Integer)

If Not (KeyAscii >= Asc("0") And KeyAscii <= Asc("9") And (KeyAscii >= Asc("a") And KeyAscii <= Asc("z") And KeyAscii = 46 Or KeyAscii = vbKeyBack)) Then KeyAscii = 0 End Sub

Private Sub cmbjurusan_keypress(KeyAscii As Integer)

If Not (KeyAscii >= Asc("0") And KeyAscii <= Asc("9") And (KeyAscii >= Asc("a") And KeyAscii <= Asc("z") And KeyAscii = 46 Or KeyAscii = vbKeyBack)) Then KeyAscii = 0 End Sub

Private Sub cmbkelas_KeyPress(KeyAscii As Integer)

If Not (KeyAscii >= Asc("0") And KeyAscii <= Asc("9") And (KeyAscii >= Asc("a") And KeyAscii <= Asc("z") And KeyAscii = 46 Or KeyAscii = vbKeyBack)) Then KeyAscii = 0 End Sub

Sub isicmbjurusan() Call koneksi

rsjurusan.Open "select * from jurusan", KON cmbjurusan.Clear

Do While Not rsjurusan.EOF

cmbjurusan.AddItem rsjurusan!kode_jurusan rsjurusan.MoveNext

Loop End Sub

(76)

76 Call koneksi

rskelas.Open "select * from kelas where kode_jurusan='" & cmbjurusan.Text & "'", KON cmbkelas.Clear

Do While Not rskelas.EOF

cmbkelas.AddItem rskelas!id_kelas rskelas.MoveNext

Loop End Sub

Private Sub Form_Load() tampilgrid nonaktif bersih dttanggal.Visible = True isicmbjurusan End Sub

Private Sub optnama_Click() txtkey.Enabled = True txtkey.SetFocus End Sub

Private Sub optnis_Click() txtkey.Enabled = True txtkey.SetFocus End Sub

Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button) If Button.Index = 1 Then

Referensi

Dokumen terkait

Stasiun 4 memiliki nilai indeks dominasi yang lebih tinggi (0,44) dibandingkan dengan stasiun lainnya. Berdasarkan analisis PCA dapat disimpulkan bahwa terdapat

Motif jasmaniah adalah motivasi yang dikarenakan tuntutan jasmani, seperti reflex, insting otomatis dan nafsu. Dari beberapa hasil wawancara yang didapat ada

Udang windu fase prematurasi yang diberi pakan dengan penambahan vitamin C (mengandung 406,1 mg/kg pakan) dan vitamin E (mengandung 286,3 mg/ kg pakan) memiliki performansi

Berdasarkan hasil uji statistik, maka pada penelitian tersebut, hipotesis kerja diterima, yaitu terdapat perbedaan tingkat konsentrasi belajar siswa antara kebisingan

7) Kompetensi dasar dikembangkan didasarkan pada prinsip akumulatif, saling memperkuat (reinforced) dan memperkaya (en riched ) antar mata pelajaran

• Titik N merupakan portofolio aset berisiko dengan bobot investasi adalah 77,8 persen untuk saham AAA, 5,5 persen untuk saham BBB, dan 16,7 persen untuk saham CCC.. TEKNIK

Motor sinkron digunak DQ XQWXN PHPSHUEDLNL FRV - \DLWX IDNWRU GD\D sehingga menghasilkan kualitas kerja yang baik. Kemampuan suatu motor untuk menghasilkan putaran sangat