SISTEM INFORMASI ADMINISTRASI
PELATIHAN PRIVAT KOMPUTER PADA DELLSA COMPUTER BANGGAI (Ms. Visual Basic 6.0)
Sebelum anda memulai pembuatan program, terlebih dahulu anda harus mempersiapkan kebutuhan-kebutuhan yang akan dipergunakan.Diantaranya :
1. Komputer anda harus terinstal Visual Basic 6 secara lengkap, dilengkapi dengan komponen tambahan yaitu XPButton serta icon-icon pendukungnya.
2. Harus terinstal Crystal Report. Versi yang terbaik disarankan memakai versi 8.5
3. Untuk pembuatan database, kita harus menggunakan program aplikasi Ms. Acces agar memudahkan anda didalam pengaturan backup data.
Catatan : Perlu anda ketahui bahwa program ini sesuai dengan sistem administrasi yang ada pada Dellsa Computer Banggai. Kekurangan dari Program ini adalah PR buat anda dan kelebihannya ada pada programmer itu sendiri, Ok. Selamat Bekerja !!!
Public Koneksi As New ADODB.Connection Public RsLogin As New ADODB.Recordset Public Rssiswa As New ADODB.Recordset Public Rsbiaya As New ADODB.Recordset Public Rskelas As New ADODB.Recordset Public Rspaket As New ADODB.Recordset Public Rsalumni As New ADODB.Recordset
Public Rspembayaran As New ADODB.Recordset Public Rstunggu As New ADODB.Recordset Public Rsstatus As New ADODB.Recordset Sub BukaDatabase()
Set Koneksi = Nothing
Koneksi.CursorLocation = adUseClient
Koneksi.Open "Provider = Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\dbsprivat.mdb;jet OLEDB:Database Password=;"
Rssiswa.Open "[tblsiswa]", Koneksi, adOpenDynamic, adLockOptimistic Rsbiaya.Open "[tblbiaya]", Koneksi, adOpenDynamic, adLockOptimistic Rskelas.Open "[tblkelas]", Koneksi, adOpenDynamic, adLockOptimistic Rspaket.Open "[tblpaket]", Koneksi, adOpenDynamic, adLockOptimistic Rsalumni.Open "[tblalumni]", Koneksi, adOpenDynamic, adLockOptimistic
Rspembayaran.Open "[tblpembayaran]", Koneksi, adOpenDynamic, adLockOptimistic Rstunggu.Open "[tbltunggu]", Koneksi, adOpenDynamic, adLockOptimistic
Rsstatus.Open "[tblstatus]", Koneksi, adOpenDynamic, adLockOptimistic RsLogin.Open "[Password]", Koneksi, adOpenDynamic, adLockOptimistic End Sub
Buat modul baru dengan mengklik pada menu Project... Add Module, ketik listing dibawah ini dan simpan dengan nama Modul1
Selanjutnya kita harus mempersiapkan komponen-komponen yang kita
perlukan pada Visual Basic, cara : klik kanan pada Toolbox, maka akan tampil gambar dibawah ini :
Ceklist komponen-komponen : 1. Crystal Report Control
2. Microsoft Ado Data Control 6.0 (OLEDB) 3. Microsoft DataGrid Control 6.0 (OLEDB)
4. Microsoft Windows Common Control 5.0(ELEDB) 5. Microsoft Windows Common Control 6.0
6. Microsoft Windows Common Control -2.6.0 7. UcXPButton
Form Paket Pelatihan
Design Form seperti gambar dibawah ini, dan berikan nama FrmPaket
Ketik Listing dibawah ini ! Public Ada1, Valid As Boolean
Dim RsTampil As New ADODB.Recordset Private Sub blankform1()
txtnamapkt.Text = "" cbolama.Text = "" End Sub
Private Sub tidaksiapisi() txtnamapkt.Enabled = False cbolama.Enabled = False
txtnamapkt.BackColor = &H80000016 cbolama.BackColor = &H80000016 End Sub
Private Sub SiapIsi1()
txtnamapkt.Enabled = True cbolama.Enabled = True
txtnamapkt.BackColor = &H80000005 cbolama.BackColor = &H80000005 End Sub
Private Sub isitabelpaket() Rspaket!kodepkt = txtkode.Text Rspaket!namapkt = txtnamapkt.Text Rspaket!Lamabljr = cbolama.Text End Sub
Private Sub AktifTombol() cmdsimpan.Enabled = True cmdedit.Enabled = True cmdhapus.Enabled = True End Sub
Private Sub tutuptombol() cmdhapus.Enabled = False cmdedit.Enabled = False End Sub
Private Sub isiformpaket()
txtnamapkt.Text = Rspaket!namapkt cbolama.Text = Rspaket!Lamabljr End Sub
Private Sub Validasi() Valid = False
If txtkode.Text = Empty Then
x = MsgBox("Kode Jurusan harus diisi", 0 + 16, "konfirmasi") txtkode.Text = ""
txtkode.SetFocus Exit Sub
ElseIf txtnamapkt.Text = Empty Then
x = MsgBox("namapkt Jurusan harus diisi", 0 + 16, "konfirmasi") txtnamapkt.Text = ""
txtnamapkt.SetFocus Exit Sub
ElseIf cbolama.Text = Empty Then
x = MsgBox("Lama Pelatihan harus diisi", 0 + 16, "konfirmasi") cbolama.Text = "" cbolama.SetFocus Exit Sub End If Valid = True End Sub
Private Sub Tampildata() Set RsTampil = Nothing
RsTampil.Open "select * from Tblpaket order by KodePkt ", Koneksi, adOpenDynamic, adLockOptimistic
Set Grid1.DataSource = RsTampil Grid1.Columns(0).Width = 1500 Grid1.Columns(1).Width = 5700 Grid1.Columns(2).Width = 1250
Grid1.Columns(0).Alignment = dbgCenter Grid1.Columns(2).Alignment = dbgCenter
Grid1.Columns(0).Caption = "KODE PAKET" Grid1.Columns(1).Caption = "NAMA PAKET" Grid1.Columns(2).Caption = "LAMA PELATIHAN" End Sub
Private Sub Form_Activate()
mdmenuutama.Enabled = False End Sub
Private Sub Form_Load() BukaDatabase blankform1 tidaksiapisi tutuptombol txtkode.Text = "" cmdsimpan.Caption = "&Tambah" Tampildata cbolama.List(0) = "1 Bulan " cbolama.List(1) = "2 Bulan " cbolama.List(2) = "3 Bulan " cbolama.List(3) = "4 Bulan " End Sub
Private Sub Form_Unload(Cancel As Integer) Koneksi.Close
End Sub
Private Sub txtkode_Click() txtnamapkt.Text = "" cbolama.Text = "" End Sub
Private Sub txtkode_KeyPress(keyascii As Integer)
If Not (keyascii >= Asc("0") And keyascii <= Asc("9") Or _ keyascii = vbKeyBack) Then
keyascii = 0 End If
End Sub
Private Sub txtkode_Lostfocus() ckode = Trim(txtkode.Text) If ckode = Empty Then Exit Sub
If Rspaket.RecordCount > 0 Then Rspaket.MoveFirst
End If
Rspaket.Find ("KodePkt = '" & ckode & "'") If Rspaket.EOF Then blankform1 SiapIsi1 txtnamapkt.SetFocus Ada1 = False tutuptombol cmdsimpan.Caption = "&Simpan" Else tidaksiapisi isiformpaket cmdedit.Enabled = True cmdhapus.Enabled = True Ada1 = True End If End Sub
Private Sub CmdSimpan_Click()
If cmdsimpan.Caption = "&Tambah" Then CmdBatal_Click
Exit Sub End If Validasi
If Valid = True Then If Ada1 = False Then Rspaket.AddNew isitabelpaket Rspaket.Update Else
Koneksi.Execute "update Tblpaket set namapkt='" + txtnamapkt + "'," & "Lamabljr='" + cbolama + "' where KodePkt ='" + txtkode + "'"
End If cmdsimpan.Caption = "&Tambah" Else cmdsimpan.Caption = "&Simpan" End If Rspaket.Requery Tampildata End Sub
Private Sub CmdBatal_Click() blankform1 tidaksiapisi txtkode.Enabled = True txtkode.BackColor = &H80000005 txtkode.SetFocus cmdsimpan.Caption = "&Tambah" tutuptombol End Sub
Private Sub cmdedit_click() tutuptombol Ada1 = True SiapIsi1 txtkode.Enabled = False txtkode.BackColor = &H80000016 cmdsimpan.Caption = "&Simpan" txtnamapkt.SetFocus End Sub
Private Sub CmdHapus_Click() ckode = Trim(txtkode.Text)
Rssiswa.Find ("KodePkt='" & ckode & "'"), , adSearchForward, 1
Rspembayaran.Find ("KodePkt='" & ckode & "'"), , adSearchForward, 1 If Not Rssiswa.EOF Then
x = MsgBox("maaf paket pelatihan tersebut tidak dapat dihapus", 0 + 16, "konfirmasi") txtkode.SetFocus
Exit Sub
ElseIf Not Rspembayaran.EOF Then
x = MsgBox("maaf paket pelatihan tersebut tidak dapat dihapus", 0 + 16, "konfirmasi") txtkode.SetFocus
Exit Sub Else
Y = MsgBox("Benar anda ingin hapus ???", vbYesNo + vbQuestion + vbDefaultButton2, "konfirmasi")
Select Case Y Case vbYes
Koneksi.Execute "delete * from Tblpaket where KodePkt ='" & ckode & "'" Case vbNo End Select End If CmdBatal_Click Rspaket.Requery Tampildata End Sub
Private Sub CmdKeluar_Click() Unload Me
mdmenuutama.Enabled = True End Sub
Private Sub Grid1_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then
If Rspaket.RecordCount > 0 Then txtkode.Text = Grid1.Columns(0) txtkode_Lostfocus End If End If End Sub
Private Sub txtkode_keydown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then
SendKeys vbTab End If
End Sub
Private Sub cbolama_keydown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then
SendKeys vbTab End If
End Sub
Private Sub txtnamapkt_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then
SendKeys vbTab End If
Form Jenis Biaya Pelatihan
Design Form seperti gambar dibawah ini, dan berikan nama FrmJenisBiaya
Ketik Listing dibawah ini !
Public Ada, Ada1, Valid As Boolean Public Sql As String
Dim RsTampil As New ADODB.Recordset Private Sub blankform1()
txtjnsby.Text = "" txtkodeby.Text = "" txtjnsby.Text = "" txtjml.Text = "" End Sub
Private Sub Blankform2() txtkodeby.Text = "" txtjnsby.Text = "" txtjml.Text = "" End Sub
Private Sub tidaksiapisi() txtjnsby.Enabled = False txtkodeby.Enabled = False txtjnsby.Enabled = False
txtjml.Enabled = False txtjnsby.BackColor = &H80000016 txtkodeby.BackColor = &H80000016 txtjnsby.BackColor = &H80000016 txtjml.BackColor = &H80000016 End Sub
Private Sub SiapIsi1() txtjnsby.Enabled = True txtjml.Enabled = True
txtjnsby.BackColor = &H80000005 txtjml.BackColor = &H80000005 End Sub
Private Sub SiapIsi2() txtkodeby.Enabled = True txtjnsby.Enabled = True txtjml.Enabled = True txtkodeby.BackColor = &H80000005 txtjnsby.BackColor = &H80000005 txtjml.BackColor = &H80000005 End Sub
Private Sub isitabeljenisbiaya() Rsbiaya!kodepkt = txtkodepkt.Text Rsbiaya!kodeby = txtkodeby.Text Rsbiaya!jnsby = txtjnsby.Text Rsbiaya!jmlby = txtjml.Text Rsbiaya!ta = txtthn.Text End Sub
Private Sub AktifTombol() cmdsimpan.Enabled = True cmdedit.Enabled = True cmdhapus.Enabled = True End Sub
Private Sub tutuptombol() cmdhapus.Enabled = False cmdedit.Enabled = False End Sub
Private Sub isiformjenisbiaya() txtjnsby.Text = Rsbiaya!jnsby txtjml.Text = Rsbiaya!jmlby End Sub
Private Sub Validasi() Valid = False
If txtkodeby.Text = Empty Then
txtkodeby.Text = "" txtkodeby.SetFocus Exit Sub
ElseIf txtjnsby.Text = Empty Then
x = MsgBox("jnsby Biaya harus diisi", 0 + 16, "konfirmasi") txtjnsby.Text = ""
txtjnsby.SetFocus Exit Sub
ElseIf txtjml.Text = Empty Then
x = MsgBox("Jumlah Biaya harus diisi", 0 + 16, "konfirmasi") txtjml.Text = "" txtjml.SetFocus Exit Sub End If Valid = True End Sub
Private Sub Tampildata() Set RsTampil = Nothing
RsTampil.Open "Select kodeby,jnsby,jmlby from " & _ " tblbiaya where kodepkt ='" & txtkodepkt & "'", Koneksi Grid1.Refresh
Set Grid1.DataSource = RsTampil Grid1.Columns(0).Width = 1500 Grid1.Columns(1).Width = 4000 Grid1.Columns(2).Width = 1250 Grid1.Columns(0).Alignment = dbgCenter Grid1.Columns(2).Alignment = dbgRight Grid1.Columns(2).NumberFormat = "#,###,###" Grid1.Columns(0).Caption = "KODE BIAYA"
Grid1.Columns(1).Caption = "JENIS BIAYA" Grid1.Columns(2).Caption = "JUMLAH" End Sub
Private Sub Form_Activate()
mdmenuutama.Enabled = False cmdsimpan.Enabled = False End Sub
Private Sub txtkodepkt_Click() txtkodepkt.Text = ""
txtjnsby.Text = "" blankform1
tidaksiapisi Tampildata End Sub
Private Sub Up1_Change() txtthn.Text = Up1
End Sub
Private Sub Form_Load() BukaDatabase blankform1 tidaksiapisi tutuptombol txtkodepkt.Text = "" cmdsimpan.Caption = "&Tambah" Up1.Value = Year(Date) End Sub
Private Sub aturtahun()
txtthn.Text = Trim(Str(Year(Date))) + "/" + Trim(Str(Year(Date) + 1)) End Sub
Private Sub Form_Unload(Cancel As Integer) Koneksi.Close
End Sub
Private Sub txtkodepkt_keydown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyF1 Then
txtkodepkt.Text = ""
Sql = "Select namapkt,kodepkt from tblpaket where kodepkt like '" & txtkodepkt & "%' order by kodepkt"
Ada = True
frminfo.Caption = " >>> Info Data Paket Tahun” & txtthn & "<<<" frminfo.Grid1.Columns(0).Caption = "NAMA PAKET"
frminfo.Grid1.Columns(1).Caption = "KODE PAKET" frminfo.Show vbModal, Me
Ada = False
txtkodepkt.Text = frminfo.Kode txtkodepkt_Lostfocus
End If
If KeyCode = vbKeyReturn Then SendKeys vbTab
End If End Sub
Private Sub txtkodepkt_Lostfocus() ckode = Trim(txtkodepkt.Text) If ckode = Empty Then Exit Sub
End If
If Rspaket.RecordCount > 0 Then Rspaket.MoveFirst
End If
If Len(ckode) >= 3 Then
Rspaket.Find ("kodepkt = '" & ckode & "'") If Rspaket.EOF Then
x = MsgBox("Maaf, Paket dengan Kode <<" & txtkodepkt.Text & ">> tsb belum ada !", 0 + 16, "Konfirmasi")
txtkodepkt.Text = "" txtkodepkt.SetFocus Exit Sub
Else
txtnamapkt.Text = Rspaket!namapkt + " / " + Rspaket!Lamabljr Blankform2 SiapIsi2 txtkodeby.SetFocus Ada1 = False cmdsimpan.Caption = "&Tambah" End If End If Tampildata Aturkodeby End Sub
Public Sub Batal()
txtkodeby.Enabled = True txtkodeby.BackColor = &H80000005 txtjnsby.Text = "" txtjml.Text = "" txtjnsby.Enabled = False txtjml.Enabled = False End Sub
Private Sub CmdSimpan_Click()
If cmdsimpan.Caption = "&Tambah" Then Batal Aturkodeby txtkodeby.SetFocus Exit Sub End If Validasi
If Valid = True Then If Ada1 = False Then Rsbiaya.AddNew isitabeljenisbiaya
Rsbiaya.Update Else
Koneksi.Execute "update tblbiaya set jnsby= '" + txtjnsby + "', " & _ " jmlby= '" + txtjml + "' where kodeby='" + txtkodeby + "'"
End If cmdsimpan.Caption = "&Tambah" Else cmdsimpan.Caption = "&Simpan" End If Rsbiaya.Requery Tampildata Aturkodeby End Sub
Private Sub CmdBatal_Click() txtkodepkt.Text = "" blankform1 tidaksiapisi txtkodepkt.Enabled = True txtkodepkt.BackColor = &H80000005 txtkodepkt.SetFocus cmdsimpan.Caption = "&Tambah" cmdsimpan.Enabled = False tutuptombol Tampildata End Sub
Private Sub cmdedit_click() tutuptombol Ada1 = True SiapIsi1 txtkodepkt.Enabled = False txtkodepkt.BackColor = &H80000016 cmdsimpan.Caption = "&Simpan" txtjnsby.SetFocus End Sub
Private Sub CmdHapus_Click() ckode = Trim(txtkodeby.Text)
Rspembayaran.Find ("kodeby='" & ckode & "'"), , adSearchForward, 1 If Not Rspembayaran.EOF Then
x = MsgBox("Jenis Biaya tersebut tidak dapat dihapus", 0 + 16, "konfirmasi") Blankform2
txtkodeby.Enabled = True
txtkodeby.BackColor = &H80000005 txtkodeby.SetFocus
Else
Y = MsgBox("Benar anda ingin hapus ???", vbYesNo + vbQuestion + vbDefaultButton2, "konfirmasi")
Select Case Y Case vbYes
Koneksi.Execute "delete * from tblbiaya where kodeby ='" & ckode & "'" Case vbNo End Select End If CmdBatal_Click Rsbiaya.Requery Tampildata End Sub
Private Sub CmdKeluar_Click() Unload Me
mdmenuutama.Enabled = True End Sub
Private Sub Grid1_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then
If Rsbiaya.RecordCount > 0 Then txtkodeby.Text = Grid1.Columns(0) txtkodeby_Lostfocus End If End If End Sub
Private Sub txtjml_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then
SendKeys vbTab End If
End Sub
Private Sub txtjnsby_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then
SendKeys vbTab End If
End Sub
Private Sub txtkodeby_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyF1 Then
txtkodeby.Text = ""
Sql = "Select jnsby,kodeby from tblbiaya Where kodepkt ='" & txtkodepkt & "' and ta='" & txtthn & "' order by kodeby"
Ada = True
frminfo.Caption = " >>> Info Data Jenis Biaya Tahun" & txtthn & "<<<" frminfo.Show vbModal, Me
Ada = False
txtkodeby.Text = frminfo.Kode txtkodeby_Lostfocus
End If
If KeyCode = vbKeyReturn Then SendKeys vbTab
End If End Sub
Private Sub txtkodeby_Lostfocus() ckode = Trim(txtkodeby.Text) If ckode = Empty Then Exit Sub
End If
If Rsbiaya.RecordCount > 0 Then Rsbiaya.MoveFirst
End If
Rsbiaya.Find ("kodeby = '" & ckode & "'") If Rsbiaya.EOF Then SiapIsi1 txtjnsby.SetFocus cmdsimpan.Enabled = True cmdsimpan.Caption = "&Simpan" Ada1 = False Else isiformjenisbiaya tidaksiapisi cmdedit.Enabled = True cmdhapus.Enabled = True cmdsimpan.Enabled = True cmdsimpan.Caption = "&Tambah" Ada1 = True End If Tampildata End Sub
Private Sub txtjml_keypress(keyascii As Integer)
If Not (keyascii >= Asc("0") And keyascii <= Asc("9") Or _ keyascii = vbKeyBack) Then
keyascii = 0 End If
End Sub
Private Sub Aturkodeby() Set RsTampil = Nothing
RsTampil.Open "Select * From tblbiaya Where kodepkt='" & txtkodepkt & "'" & _ " and Ta='" & txtthn & "' order by kodeby", Koneksi
cmk = Mid(txtthn.Text, 3, 2) + "-" txtkodeby.Text = cmk
Form Data Kelas
Design Form seperti gambar dibawah ini, dan berikan nama FrmKelas
Ketik Listing dibawah ini ! Public Ada1, Valid As Boolean
Dim RsTampil As New ADODB.Recordset Private Sub blankform1()
txtnamakls.Text = "" txtmulaibljr.Text = "" txtselesaibljr.Text = "" txtjmlsiswa.Text = "" End Sub
Private Sub tidaksiapisi() txtnamakls.Enabled = False txtmulaibljr.Enabled = False txtselesaibljr.Enabled = False txtjmlsiswa.Enabled = False txtnamakls.BackColor = &H80000016 txtmulaibljr.BackColor = &H80000016 txtselesaibljr.BackColor = &H80000016 txtjmlsiswa.BackColor = &H80000016 End Sub
Private Sub SiapIsi1()
txtmulaibljr.Enabled = True txtselesaibljr.Enabled = True txtjmlsiswa.Enabled = True txtnamakls.BackColor = &H80000005 txtmulaibljr.BackColor = &H80000005 txtselesaibljr.BackColor = &H80000005 txtjmlsiswa.BackColor = &H80000005 End Sub
Private Sub isitabelkelas() Rskelas!kodekls = txtkode.Text Rskelas!namakls = txtnamakls.Text Rskelas!Mulaibljr = txtmulaibljr.Text Rskelas!selesaibljr = txtselesaibljr.Text Rskelas!jmlsiswa = txtjmlsiswa.Text End Sub
Private Sub AktifTombol() cmdsimpan.Enabled = True cmdedit.Enabled = True cmdhapus.Enabled = True End Sub
Private Sub tutuptombol() cmdhapus.Enabled = False cmdedit.Enabled = False End Sub
Private Sub isiformkelas()
txtnamakls.Text = Rskelas!namakls txtmulaibljr.Text = Rskelas!Mulaibljr txtselesaibljr.Text = Rskelas!selesaibljr txtjmlsiswa.Text = Rskelas!jmlsiswa End Sub
Private Sub Validasi() Valid = False
If txtkode.Text = Empty Then
x = MsgBox("Kode Jurusan harus diisi", 0 + 16, "konfirmasi") txtkode.Text = ""
txtkode.SetFocus Exit Sub
ElseIf txtnamakls.Text = Empty Then
x = MsgBox("namakls Jurusan harus diisi", 0 + 16, "konfirmasi") txtnamakls.Text = ""
txtnamakls.SetFocus Exit Sub
ElseIf txtmulaibljr.Text = Empty Then
txtmulaibljr.Text = "" txtmulaibljr.SetFocus Exit Sub
ElseIf txtselesaibljr.Text = Empty Then
x = MsgBox("Jam Selesai Belajar harus diisi", 0 + 16, "konfirmasi") txtselesaibljr.Text = ""
txtselesaibljr.SetFocus Exit Sub
ElseIf txtjmlsiswa.Text = Empty Then
x = MsgBox("Jumlah siswa harus diisi", 0 + 16, "konfirmasi") txtjmlsiswa.Text = "" txtjmlsiswa.SetFocus Exit Sub End If Valid = True End Sub
Private Sub Tampildata() Set RsTampil = Nothing
RsTampil.Open "select * from tblkelas order by kodekls ", Koneksi, adOpenDynamic, adLockOptimistic
Set Grid1.DataSource = RsTampil Grid1.Columns(0).Width = 1500 Grid1.Columns(1).Width = 3000 Grid1.Columns(2).Width = 1250 Grid1.Columns(3).Width = 1250 Grid1.Columns(4).Width = 1250 Grid1.Columns(0).Alignment = dbgCenter Grid1.Columns(2).Alignment = dbgCenter Grid1.Columns(3).Alignment = dbgCenter Grid1.Columns(4).Alignment = dbgCenter Grid1.Columns(0).Caption = "KODE KELAS" Grid1.Columns(1).Caption = "NAMA KELAS"
Grid1.Columns(2).Caption = "JAM MULAI BELAJAR" Grid1.Columns(3).Caption = "JAM MULAI SELESAI" Grid1.Columns(4).Caption = "JUMLAH SISWA" End Sub
Private Sub Form_Activate()
mdmenuutama.Enabled = False End Sub
Private Sub Form_Load() BukaDatabase
tidaksiapisi tutuptombol txtkode.Text = "" cmdsimpan.Caption = "&Tambah" Tampildata End Sub
Private Sub Form_Unload(Cancel As Integer) Koneksi.Close
End Sub
Private Sub txtkode_Click() txtnamakls.Text = ""
txtmulaibljr.Text = "" txtselesaibljr.Text = "" txtjmlsiswa.Text = "" End Sub
Private Sub txtkode_Lostfocus() ckode = Trim(txtkode.Text) If ckode = Empty Then Exit Sub
End If
If Rskelas.RecordCount > 0 Then Rskelas.MoveFirst
End If
Rskelas.Find ("kodekls = '" & ckode & "'") If Rskelas.EOF Then blankform1 SiapIsi1 txtnamakls.SetFocus Ada1 = False tutuptombol cmdsimpan.Caption = "&Simpan" Else tidaksiapisi isiformkelas cmdedit.Enabled = True cmdhapus.Enabled = True Ada1 = True End If End Sub
Private Sub CmdSimpan_Click()
If cmdsimpan.Caption = "&Tambah" Then CmdBatal_Click
Exit Sub End If Validasi
If Valid = True Then If Ada1 = False Then Rskelas.AddNew isitabelkelas Rskelas.Update Else
Koneksi.Execute "update tblkelas set namakls='" + txtnamakls + "'," & "mulaibljr='" + txtmulaibljr + "', selesaibljr='" + txtselesaibljr + "', jmlsiswa='" + txtjmlsiswa + "' where kodekls ='" + txtkode + "'" End If cmdsimpan.Caption = "&Tambah" Else cmdsimpan.Caption = "&Simpan" End If Rskelas.Requery Tampildata End Sub
Private Sub CmdBatal_Click() blankform1 tidaksiapisi txtkode.Enabled = True txtkode.BackColor = &H80000005 txtkode.SetFocus cmdsimpan.Caption = "&Tambah" tutuptombol End Sub
Private Sub cmdedit_click() tutuptombol Ada1 = True SiapIsi1 txtkode.Enabled = False txtkode.BackColor = &H80000016 cmdsimpan.Caption = "&Simpan" txtnamakls.SetFocus End Sub
Private Sub CmdHapus_Click() ckode = Trim(txtkode.Text)
Rssiswa.Find ("kodekls='" & ckode & "'"), , adSearchForward, 1 Rstunggu.Find ("kodekls='" & ckode & "'"), , adSearchForward, 1
If Not Rssiswa.EOF Then
x = MsgBox("maaf kode jurusan tersebut tidak dapat dihapus", 0 + 16, "konfirmasi") txtkode.SetFocus
Exit Sub
ElseIf Not Rstunggu.EOF Then
x = MsgBox("maaf kode jurusan tersebut tidak dapat dihapus", 0 + 16, "konfirmasi") txtkode.SetFocus
Exit Sub Else
Y = MsgBox("Benar anda ingin hapus ???", vbYesNo + vbQuestion + vbDefaultButton2, "konfirmasi")
Select Case Y Case vbYes
Koneksi.Execute "delete * from tblkelas where kodekls ='" & ckode & "'" Case vbNo End Select End If CmdBatal_Click Rskelas.Requery Tampildata End Sub
Private Sub CmdKeluar_Click() Unload Me
mdmenuutama.Enabled = True End Sub
Private Sub Grid1_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then
If Rskelas.RecordCount > 0 Then txtkode.Text = Grid1.Columns(0) txtkode_Lostfocus End If End If End Sub
Private Sub txtkode_keydown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then
SendKeys vbTab End If
End Sub
Private Sub txtselesaibljr_keydown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then
SendKeys vbTab End If
Private Sub txtjmlsiswa_keydown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then
SendKeys vbTab End If
End Sub
Private Sub txtjmlsiswa_keypress(keyascii As Integer) If Not (keyascii >= Asc("0") And keyascii <= Asc("9") Or _ keyascii = vbKeyBack) Then
keyascii = 0 End If
End Sub
Private Sub txtmulaibljr_keydown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then
SendKeys vbTab End If
End Sub
Private Sub txtnamakls_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then
SendKeys vbTab End If
Form Calon Siswa
Design Form seperti gambar dibawah ini, dan berikan nama FrmCalonSiswa
Ketik Listing dibawah ini ! Public Ada, Ada1, Valid As Boolean Public Sql, cno, cnama As String
Dim RsTampil As New ADODB.Recordset Private Sub blankform1()
txtnamapkt.Text = "" txtalamat.Text = "" txtno_daftar.Text = "" txtnama_calon.Text = "" cbokelamin.Text = "" cbopendidikan.Text = "" txttelp.Text = "" txtkodekls.Text = "" txtnamakls.Text = "" End Sub
Private Sub Blankform2() txtno_daftar.Text = "" txtalamat.Text = "" txtnama_calon.Text = "" cbopendidikan.Text = "" cbokelamin.Text = ""
txttelp.Text = "" End Sub
Private Sub tidaksiapisi() txtnamapkt.Enabled = False txtkodekls.Enabled = False txtnamakls.Enabled = False txtno_daftar.Enabled = False txtalamat.Enabled = False txtnama_calon.Enabled = False cbopendidikan.Enabled = False dtpdaftar.Enabled = False cbokelamin.Enabled = False txttelp.Enabled = False txtalamat.BackColor = &H80000016 txtnamapkt.BackColor = &H80000016 txtno_daftar.BackColor = &H80000016 txtnama_calon.BackColor = &H80000016 dtpdaftar.CalendarBackColor = &H80000016 cbokelamin.BackColor = &H80000016 cbopendidikan.BackColor = &H80000016 txttelp.BackColor = &H80000016 cbopendidikan.BackColor = &H80000016 End Sub
Private Sub SiapIsi1()
txtnama_calon.Enabled = True txtalamat.Enabled = True cbokelamin.Enabled = True cbopendidikan.Enabled = True txttelp.Enabled = True dtpdaftar.Enabled = True txtalamat.BackColor = &H80000005 txtnamapkt.BackColor = &H80000005 cbopendidikan.BackColor = &H80000005 txtno_daftar.BackColor = &H80000005 txtnama_calon.BackColor = &H80000005 cbokelamin.BackColor = &H80000005 txttelp.BackColor = &H80000005 End Sub
Private Sub SiapIsi2()
txtno_daftar.Enabled = True
txtno_daftar.BackColor = &H80000016 txtalamat.BackColor = &H80000016 cbopendidikan = &H80000016
txtno_daftar.BackColor = &H80000016 txtnama_calon.BackColor = &H80000016 cbokelamin.BackColor = &H80000016 dtpdaftar.CalendarBackColor = &H80000016 txttelp.BackColor = &H80000016 End Sub
Private Sub isitabelcalon()
Rstunggu!kodepkt = txtkodepkt.Text Rstunggu!nodaftar = txtno_daftar.Text Rstunggu!nama = txtnama_calon.Text Rstunggu!jns_kel = cbokelamin.Text Rstunggu!tgldaftar = dtpdaftar Rstunggu!pendidikan = cbopendidikan.Text Rstunggu!notelp = txttelp.Text Rstunggu!thn_masuk = txtthn.Text Rstunggu!ket = "Ok" Rstunggu!alamat = txtalamat.Text Rstunggu!kodekls = txtkodekls.Text End Sub
Private Sub AktifTombol() cmdsimpan.Enabled = True cmdedit.Enabled = True cmdhapus.Enabled = True End Sub
Private Sub tutuptombol() cmdhapus.Enabled = False cmdedit.Enabled = False cmdsimpan.Enabled = False End Sub
Private Sub isiformsiswa()
txtnama_calon.Text = Rstunggu!nama dtpdaftar = Rstunggu!tgldaftar cbokelamin.Text = Rstunggu!jns_kel txttelp.Text = Rstunggu!notelp cbopendidikan.Text = Rstunggu!pendidikan txtthn.Text = Rstunggu!thn_masuk txtalamat.Text = Rstunggu!alamat End Sub
Private Sub Validasi() Valid = False
If txtno_daftar.Text = Empty Then
x = MsgBox("Nomor Daftar Siswa harus diisi", 0 + 16, "konfirmasi") txtno_daftar.Text = ""
txtno_daftar.SetFocus Exit Sub
ElseIf txtnama_calon.Text = Empty Then
x = MsgBox("Nama Calon harus diisi", 0 + 16, "konfirmasi") txtnama_calon.Text = ""
txtnama_calon.SetFocus Exit Sub
ElseIf cbokelamin.Text = Empty Then
x = MsgBox("Jenis Kelamin harus diisi", 0 + 16, "konfirmasi") cbokelamin.Text = ""
cbokelamin.SetFocus
ElseIf txttelp.Text = Empty Then
x = MsgBox("Harus mengisi nomor Telp atau HP untuk bisa dihubungi jika ada kepentingan", 0 + 16, "konfirmasi")
txttelp.Text = "" txttelp.SetFocus Exit Sub
ElseIf cbopendidikan.Text = Empty Then
x = MsgBox("Asal sekolah harus diisi", 0 + 16, "konfirmasi") cbopendidikan.Text = ""
cbopendidikan.SetFocus Exit Sub
ElseIf txtkodepkt.Text = Empty Then
x = MsgBox("Kode Paket harus diisi", 0 + 16, "konfirmasi") txtkodepkt.Text = ""
txtkodepkt.SetFocus Exit Sub
ElseIf txtkodekls.Text = Empty Then
x = MsgBox("Kode Kelas harus diisi", 0 + 16, "konfirmasi") txtkodekls.Text = "" txtkodekls.SetFocus Exit Sub End If Valid = True End Sub
Private Sub Tampildata() Set RsTampil = Nothing
RsTampil.Open "Select nodaftar,Nama,jns_kel,alamat,tgldaftar from " & _
" tbltunggu where kodepkt ='" & txtkodepkt & "'and thn_masuk ='" & txtthn & "'and ket='Ok' order by nodaftar,tgldaftar", Koneksi
Grid1.Refresh
Set Grid1.DataSource = RsTampil Grid1.Columns(0).Width = 1500
Grid1.Columns(1).Width = 2750 Grid1.Columns(2).Width = 1500 Grid1.Columns(3).Width = 1500 Grid1.Columns(4).Width = 1500 Grid1.Columns(0).Alignment = dbgCenter Grid1.Columns(4).Alignment = dbgCenter Grid1.Columns(0).Caption = "NO. DAFTAR" Grid1.Columns(1).Caption = "NAMA SISWA" Grid1.Columns(2).Caption = "JENIS KELAMIN" Grid1.Columns(3).Caption = "ALAMAT"
Grid1.Columns(4).Caption = "TANGGAL DAFTAR" End Sub
Private Sub Form_Activate()
mdmenuutama.Enabled = False Grid1.Enabled = False
End Sub
Private Sub Grid1_Click()
If RsTampil.RecordCount > 0 Then cmdhapus.Enabled = True Else
cmdhapus.Enabled = False End If
If txtnama_calon.Text = Empty Then cmdsimpan.Caption = "&Tambah" End If
If txtnama_calon.Text = Empty Then cmdhapus.Enabled = True Grid1.SetFocus End If txtnama_calon.Enabled = False cbokelamin.Enabled = False dtpdaftar.Enabled = False cbopendidikan.Enabled = False txtalamat.Text = "" txttelp.Enabled = False End Sub
Private Sub txtkode_Click() txtkode.Text = ""
txtnamapkt.Text = "" txtkodekls.Text = "" txtnamakls.Text = ""
Blankform2 tidaksiapisi txtkode.SetFocus Tampildata End Sub
Private Sub cbopendidikan_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then
SendKeys vbTab End If
End Sub
Private Sub txtnama_calon_KeyPress(keyascii As Integer) keyascii = Asc(UCase(Chr(keyascii)))
End Sub
Private Sub Up1_Change() txtthn.Text = Up1
End Sub
Private Sub Form_Load() BukaDatabase blankform1 tidaksiapisi tutuptombol txtkodepkt.Text = "" cmdsimpan.Caption = "&Tambah" cbokelamin.List(0) = "Laki-Laki" cbokelamin.List(1) = "Perempuan" cbopendidikan.List(0) = "SD" cbopendidikan.List(1) = "SMP" cbopendidikan.List(2) = "SMA" cbopendidikan.List(3) = "SMK" cbopendidikan.List(4) = "MA" cbopendidikan.List(5) = "D1" cbopendidikan.List(6) = "D2" cbopendidikan.List(7) = "D3" cbopendidikan.List(8) = "S1" Up1.Value = Year(Date) dtpdaftar = Date txtthn.Text = Up1 End Sub
Private Sub Form_Unload(Cancel As Integer) Koneksi.Close
Private Sub txtkodepkt_keydown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyF1 Then
txtkodepkt.Text = ""
Sql = "Select Namapkt,kodepkt,LamaBljr from tblpaket where kodepkt like '" & txtkodepkt & "%' order by kodepkt"
Ada = True
frminfo.Caption = " >>> Info Data Paket Tahun " & txtthn & "<<<" frminfo.Grid1.Columns(0).Caption = "KODE PAKET"
frminfo.Grid1.Columns(1).Caption = "NAMA PAKET" frminfo.Grid1.Columns(2).Caption = "LAMA BELAJAR" frminfo.Show vbModal, Me
Ada = False
txtkodepkt.Text = frminfo.Kode txtkodepkt_Lostfocus
End If
If KeyCode = vbKeyReturn Then SendKeys vbTab
End If End Sub
Private Sub txtkodepkt_Lostfocus() ckode = Trim(txtkodepkt.Text) If ckode = Empty Then Exit Sub End If If Rspaket.RecordCount > 0 Then Rspaket.MoveFirst End If If Len(ckode) >= 3 Then
Rspaket.Find ("kodepkt = '" & ckode & "'") If Rspaket.EOF Then
x = MsgBox("Maaf, Paket dengan Kode <<" & txtkodepkt.Text & ">> tsb belum ada !", 0 + 16, "Konfirmasi")
txtkodepkt.Text = "" txtkodepkt.SetFocus Exit Sub
Else
txtnamapkt.Text = Rspaket!namapkt + " / " + Rspaket!Lamabljr txtkodekls.Enabled = True txtkodekls.SetFocus Ada1 = False cmdsimpan.Caption = "&Tambah" End If End If End Sub
Private Sub txtkodekls_keydown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyF1 Then
txtkodekls.Text = ""
Sql = "Select Namakls,kodekls,Mulaibljr from tblkelas where kodekls like '" & txtkodekls & "%' order by kodekls"
Ada = True
frminfo.Caption = " >>> Info Data Kelas Tahun " & txtthn & "<<<" frminfo.Grid1.Columns(0).Caption = "KODE KELAS"
frminfo.Grid1.Columns(1).Caption = "NAMA KELAS" frminfo.Grid1.Columns(2).Caption = "MULAI BELAJAR" frminfo.Show vbModal, Me
Ada = False
txtkodekls.Text = frminfo.Kode txtkodekls_Lostfocus
End If
If KeyCode = vbKeyReturn Then SendKeys vbTab
End If End Sub
Private Sub txtkodekls_Lostfocus() ckode = Trim(txtkodekls.Text) If ckode = Empty Then Exit Sub End If If Rskelas.RecordCount > 0 Then Rskelas.MoveFirst End If If Len(ckode) >= 3 Then
Rskelas.Find ("kodekls = '" & ckode & "'") If Rskelas.EOF Then
x = MsgBox("Maaf, Kelas dengan Kode <<" & txtkodepkt.Text & ">> tsb belum ada !", 0 + 16, "Konfirmasi")
txtkodekls.Text = "" txtkodekls.SetFocus Exit Sub
Else
txtnamakls.Text = Rskelas!namakls + " / " + " Mulai Belajar : " + Rskelas!Mulaibljr Blankform2 SiapIsi2 cbopendidikan.Text = "" txtno_daftar.Enabled = True txtno_daftar.SetFocus Aturno_daftar Ada1 = False
cmdsimpan.Caption = "&Tambah" End If End If Tampildata txtjml_siswa.Text = RsTampil.RecordCount Aturno_daftar Grid1.Enabled = True End Sub
Public Sub Batal()
txtno_daftar.Enabled = True txtno_daftar.BackColor = &H80000005 txtnama_calon.Text = "" cbokelamin.Text = "" cbopendidikan.Text = "" txttelp.Text = "" txtalamat.Text = "" cbopendidikan.Enabled = False txtalamat.Enabled = False txtnama_calon.Enabled = False cbokelamin.Enabled = False txttelp.Enabled = False cmdsimpan.Enabled = False End Sub
Private Sub CmdSimpan_Click()
If cmdsimpan.Caption = "&Tambah" Then Batal Aturno_daftar txtno_daftar.SetFocus Exit Sub End If Validasi
If Valid = True Then If Ada1 = False Then Rstunggu.AddNew isitabelcalon Rstunggu.Update Else isitabelcalon Rstunggu.Update End If cmdsimpan.Caption = "&Tambah" Else cmdsimpan.Caption = "&Simpan" End If
Rstunggu.Requery Tampildata
Aturno_daftar
txtjml_siswa.Text = RsTampil.RecordCount End Sub
Private Sub CmdBatal_Click() txtkodepkt.Text = "" txtjml_siswa.Text = "" blankform1 tidaksiapisi txtkodepkt.Enabled = True txtkodepkt.BackColor = &H80000005 txtkodekls.BackColor = &H80000005 txtkodepkt.SetFocus cmdsimpan.Caption = "&Tambah" tutuptombol Tampildata End Sub
Private Sub cmdedit_click() tutuptombol cmdsimpan.Enabled = True Ada1 = True SiapIsi1 txtkodepkt.Enabled = False txtkodepkt.BackColor = &H80000016 cmdsimpan.Caption = "&Simpan" txtnama_calon.SetFocus End Sub
Private Sub CmdHapus_Click() cmdhapus.Enabled = False cno = Grid1.Columns(0) cnama = Grid1.Columns(1)
Y = MsgBox("benar anda ingin batalkan calon Siswa dari pendaftaran ???", vbYesNo + vbQuestion + vbDefaultButton2, "Konfirmasi")
Select Case Y Case vbYes
Koneksi.Execute "Update tbltunggu set Ket='Batal' where nodaftar='" & cno & "'" 'Koneksi.Execute "Update nomor_kamar set status_kamar ='Kosong' where no_kamar ='" & cno & "'"
txtno_daftar.SetFocus
cmdhapus.Enabled = False Case vbNo
cmdsimpan.Enabled = True CmdSimpan_Click cmdhapus.Enabled = False cmdbatal.Enabled = True End Select Tampildata Aturno_daftar txtjml_siswa.Text = RsTampil.RecordCount batal1 End Sub
Private Sub CmdKeluar_Click() Unload Me
mdmenuutama.Enabled = True End Sub
Private Sub Grid1_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then
If Rstunggu.RecordCount > 0 Then txtno_daftar.Text = Grid1.Columns(0) txtno_daftar_Lostfocus End If End If End Sub
Private Sub txtnama_calon_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then
SendKeys vbTab End If
End Sub
Private Sub dtpdaftar_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then
SendKeys vbTab End If
End Sub
Private Sub cbokelamin_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then
SendKeys vbTab End If
End Sub
Private Sub Txttelp_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then
SendKeys vbTab End If
Private Sub Txtalamat_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then
SendKeys vbTab End If
End Sub
Private Sub txtno_daftar_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyF1 Then
txtno_daftar.Text = ""
Sql = "Select Alamat,nodaftar,nama from tbltunggu where kodepkt ='" & txtkodepkt & "' and thn_masuk='" & txtthn & "' and ket='Masuk' order by no_daftar,tgldaftar"
Ada = True
frminfo.Caption = " >>> Info Data Calon Siswa Tahun " & txtthn & " <<<" frminfo.Show vbModal, Me
Ada = False
txtno_daftar.Text = frminfo.Kode txtno_daftar_Lostfocus
End If
If KeyCode = vbKeyReturn Then SendKeys vbTab
End If End Sub
Private Sub txtno_daftar_Lostfocus() ckode = Trim(txtno_daftar.Text) If ckode = Empty Then
Exit Sub End If
If Rstunggu.RecordCount > 0 Then Rstunggu.MoveFirst
End If
Set Rstunggu = Nothing
Rstunggu.Open "[tbltunggu] where kodepkt = '" & txtkodepkt & "'" & _ "and nodaftar = '" & txtno_daftar & " ' And " & _
"kodepkt='" & txtkodepkt & "' and tbltunggu.ket='Ok' ", Koneksi, adOpenDynamic, adLockOptimistic If Rstunggu.EOF Then SiapIsi1 cbopendidikan.Text = "" txtalamat.Text = "" txtnama_calon.SetFocus cmdsimpan.Enabled = True cmdsimpan.Caption = "&Simpan" Ada1 = False
Set Rstunggu = Nothing
Rstunggu.Open "[tbltunggu] where kodepkt = '" & txtkodepkt & "'" & _ "and nodaftar = '" & txtno_daftar & " ' And " & _
"kodepkt='" & txtkodepkt & "' and ket='Batal' ", Koneksi, adOpenDynamic, adLockOptimistic
If Not Rstunggu.EOF Then
x = MsgBox("Maaf, No.Daftar tersebut sudah dipakai oleh calon siswa yang statusnya <BATAL> !", 0 + 64, "Konfirmasi")
txtno_daftar.Enabled = True txtno_daftar.SetFocus cmdsimpan.Caption = "&Tambah" Aturno_daftar End If Else isiformsiswa tidaksiapisi cmdedit.Enabled = True cmdsimpan.Enabled = True cmdsimpan.Caption = "&Tambah" Ada1 = True End If Tampildata End Sub
Private Sub Aturno_daftar() Set RsTampil = Nothing
RsTampil.Open "Select * From tbltunggu Where kodepkt='" & txtkodepkt & "'" & _ " and Thn_Masuk='" & txtthn & "' order by nodaftar", Koneksi
cnou = Trim(Right(txtkodepkt.Text, 2)) + Trim(Right(txtthn.Text, 2)) If RsTampil.RecordCount = 0 Then cno = "001" Else RsTampil.MoveLast Na = Val(Right(RsTampil!nodaftar, 3)) + 1 If Len(Na) = 1 Then cno = "00" + Trim(Str(Na)) ElseIf Len(Na) = 2 Then cno = "0" + Trim(Str(Na)) ElseIf Len(Na) = 3 Then cno = Trim(Str(Na)) End If
End If
txtno_daftar.Text = cnou + cno End Sub
Private Sub batal1() txtnama_calon.Text = "" cbokelamin.Text = "" cbopendidikan.Text = "" txtalamat.Text = "" txttelp.Text = "" End Sub
Private Sub Grid1_KeyPress(keyascii As Integer) cno = Grid1.Columns(0)
cnama = Grid1.Columns(1) End Sub
Form Data Siswa
Ketik Listing dibawah ini ! Public Ada, Ada1, Valid As Boolean Public Sql As String
Dim RsTampil As New ADODB.Recordset Private Sub blankform1()
txtnama.Text = "" txttempat.Text = "" cbokelamin.Text = "" cbostatus.Text = "" cboagama.Text = "" txtasal.Text = "" txtsekarang.Text = "" txttelp.Text = "" cbopekerjaan.Text = "" cbopendidikan.Text = "" cboagama.Text = "" txtstatus.Text = "" 'txtjmlsiswa.Text = "" txtkodepkt.Text = "" txtkodekls.Text = "" txtnamapkt.Text = "" txtnamakls.Text = "" End Sub
Private Sub Blankform2() txtnis.Text = "" txtnama.Text = "" txttempat.Text = "" cbokelamin.Text = "" cbostatus.Text = "" txtasal.Text = "" cboagama.Text = "" txtasal.Text = "" txtsekarang.Text = "" txttelp.Text = "" cbopendidikan.Text = "" cboagama.Text = "" txtstatus.Text = "" End Sub
Private Sub tidaksiapisi() txtnama.Enabled = False dtpdaftar.Enabled = False txtnama.Enabled = False
txttempat.Enabled = False txtasal.Enabled = False dtplahir.Enabled = False cbokelamin.Enabled = False cbostatus.Enabled = False cboagama.Enabled = False txtasal.Enabled = False txtsekarang.Enabled = False txttelp.Enabled = False cbopendidikan.Enabled = False cbopekerjaan.Enabled = False cboagama.Enabled = False txtstatus.Enabled = False txtkodekls.Enabled = False txtkodepkt.Enabled = False txtnamakls.Enabled = False txtnamapkt.Enabled = False txtnama.BackColor = &H80000016 txtkodepkt.BackColor = &H80000016 txtnamapkt.BackColor = &H80000016 txtkodekls.BackColor = &H80000016 txtnamakls.BackColor = &H80000016 txttempat.BackColor = &H80000016 dtplahir.CalendarBackColor = &H80000016 cbopekerjaan.BackColor = &H80000016 cbokelamin.BackColor = &H80000016 cbostatus.BackColor = &H80000016 cboagama.BackColor = &H80000016 txtasal.BackColor = &H80000016 txtsekarang.BackColor = &H80000016 txttelp.BackColor = &H80000016 cbopendidikan.BackColor = &H80000016 cboagama.BackColor = &H80000016 txtstatus.BackColor = &H80000016 End Sub
Private Sub SiapIsi1() txtnama.Enabled = True txttempat.Enabled = True cbokelamin.Enabled = True txtasal.Enabled = True cbostatus.Enabled = True cboagama.Enabled = True txtasal.Enabled = True txtsekarang.Enabled = True
txttelp.Enabled = True cbopendidikan.Enabled = True cbopekerjaan.Enabled = True cboagama.Enabled = True dtplahir.Enabled = True dtpdaftar.Enabled = True txtstatus.Enabled = True txtkodekls.Enabled = True txtkodepkt.Enabled = True txtnama.BackColor = &H80000005 txtnis.BackColor = &H80000005 txtnama.BackColor = &H80000005 txttempat.BackColor = &H80000005 cbokelamin.BackColor = &H80000005 cbostatus.BackColor = &H80000005 cboagama.BackColor = &H80000005 cbopekerjaan.BackColor = &H80000005 txtasal.BackColor = &H80000005 txtsekarang.BackColor = &H80000005 txttelp.BackColor = &H80000005 cbopendidikan.BackColor = &H80000005 cboagama.BackColor = &H80000005 txtstatus.BackColor = &H80000005 txtkodekls.BackColor = &H80000005 txtnamakls.BackColor = &H80000005 txtkodepkt.BackColor = &H80000005 txtnamapkt.BackColor = &H80000005 End Sub
Private Sub SiapIsi2() txtnis.Enabled = True txtnis.BackColor = &H80000016 txtnama.BackColor = &H80000016 txtnis.BackColor = &H80000016 txtnama.BackColor = &H80000016 txttempat.BackColor = &H80000016 cbokelamin.BackColor = &H80000016 cbostatus.BackColor = &H80000016 cboagama.BackColor = &H80000016 txtasal.BackColor = &H80000016 txtsekarang.BackColor = &H80000016 txttelp.BackColor = &H80000016 cbopendidikan.BackColor = &H80000016 cboagama.BackColor = &H80000016 txtstatus.BackColor = &H80000016
End Sub
Private Sub isitabelsiswa() Rssiswa!nis = txtnis.Text Rssiswa!nama = txtnama.Text Rssiswa!t4lahir = txttempat.Text Rssiswa!tgllahir = dtplahir Rssiswa!jnskel = cbokelamin.Text Rssiswa!Status = cbostatus.Text Rssiswa!agama = cboagama.Text Rssiswa!alamat_asal = txtasal.Text Rssiswa!alamat_sekarang = txtsekarang.Text Rssiswa!no_telp = txttelp.Text Rssiswa!tgl_daftar = dtpdaftar Rssiswa!pend_terakhir = cbopendidikan.Text Rssiswa!pekerjaan = cbopekerjaan Rssiswa!thn_masuk = txtthn.Text Rssiswa!Status_Siswa = "Aktif" Rssiswa!kodekls = txtkodekls.Text Rssiswa!kodepkt = txtkodepkt.Text End Sub
Private Sub AktifTombol() cmdsimpan.Enabled = True cmdedit.Enabled = True cmdhapus.Enabled = True End Sub
Private Sub tutuptombol() cmdhapus.Enabled = False cmdedit.Enabled = False cmdsimpan.Enabled = False End Sub
Private Sub isiformsiswa() txtnama.Text = Rssiswa!nama txttempat.Text = Rssiswa!t4lahir dtplahir = Rssiswa!tgllahir cbokelamin.Text = Rssiswa!jnskel cbostatus.Text = Rssiswa!Status cboagama.Text = Rssiswa!agama txtasal.Text = Rssiswa!alamat_asal txtsekarang.Text = Rssiswa!alamat_sekarang txttelp.Text = Rssiswa!no_telp cbopendidikan.Text = Rssiswa!pend_terakhir cbopekerjaan = Rssiswa!pekerjaan 'txtthn.Text = Rssiswa!thn_masuk
txtstatus.Text = Rssiswa!Status_Siswa dtpdaftar = Rssiswa!tgl_daftar txtkodekls.Text = Rssiswa!kodekls txtkodepkt.Text = Rssiswa!kodepkt End Sub
Private Sub Validasi() Valid = False
If txtnis.Text = Empty Then
x = MsgBox("Nomor Induk Siswa harus diisi", 0 + 16, "konfirmasi") txtnis.Text = ""
txtnis.SetFocus Exit Sub
ElseIf txtnama.Text = Empty Then
x = MsgBox("Nama siswa harus diisi", 0 + 16, "konfirmasi") txtnama.Text = ""
txtnama.SetFocus Exit Sub
ElseIf txttempat.Text = Empty Then
x = MsgBox("Tempat Lahir harus diisi", 0 + 16, "konfirmasi") txttempat.Text = ""
txttempat.SetFocus Exit Sub
ElseIf cbokelamin.Text = Empty Then
x = MsgBox("Jenis Kelamin harus diisi", 0 + 16, "konfirmasi") cbokelamin.Text = ""
cbokelamin.SetFocus
ElseIf cbostatus.Text = Empty Then
x = MsgBox("Status harus diisi", 0 + 16, "konfirmasi") cbostatus.Text = ""
cbostatus.SetFocus Exit Sub
ElseIf cboagama.Text = Empty Then
x = MsgBox("Agama harus diisi", 0 + 16, "konfirmasi") cboagama.Text = ""
cboagama.SetFocus Exit Sub
ElseIf txtasal.Text = Empty Then
x = MsgBox("Alamat Asal harus diisi", 0 + 16, "konfirmasi") txtasal.Text = ""
txtasal.SetFocus Exit Sub
ElseIf txtsekarang.Text = Empty Then
x = MsgBox("Alamat sekarang harus diisi", 0 + 16, "konfirmasi") txtsekarang.Text = ""
txtsekarang.SetFocus Exit Sub
ElseIf txttelp.Text = Empty Then
x = MsgBox("Harus mengisi nomor Telp atau HP untuk bisa dihubungi jika ada kepentingan", 0 + 16, "konfirmasi")
txttelp.Text = "" txttelp.SetFocus Exit Sub
ElseIf cbopendidikan.Text = Empty Then
x = MsgBox("Pendidikan Terakhir harus diisi", 0 + 16, "konfirmasi") cbopendidikan.Text = ""
cbopendidikan.SetFocus Exit Sub
ElseIf cbopekerjaan.Text = Empty Then
x = MsgBox("Pekerjaan Madyasiswa / i harus diisi", 0 + 16, "konfirmasi") cbopekerjaan.Text = ""
cbopekerjaan.SetFocus Exit Sub
ElseIf txtkodekls.Text = Empty Then
x = MsgBox("Kode kelas harus diisi", 0 + 16, "konfirmasi") txtkodekls.Text = ""
txtkodekls.SetFocus Exit Sub
ElseIf txtkodepkt.Text = Empty Then
x = MsgBox("Kode Paket harus diisi", 0 + 16, "konfirmasi") txtkodepkt.Text = "" txtkodepkt.SetFocus Exit Sub End If Valid = True End Sub
Private Sub Tampildata() Set RsTampil = Nothing
RsTampil.Open "Select nis,Nama,pend_terakhir,status_siswa from " & _ " tblsiswa where thn_masuk ='" & txtthn & "'", Koneksi
Grid1.Refresh
Set Grid1.DataSource = RsTampil Grid1.Columns(0).Width = 1750 Grid1.Columns(1).Width = 3000 Grid1.Columns(2).Width = 1500 Grid1.Columns(3).Width = 1000
Grid1.Columns(3).Alignment = dbgCenter Grid1.Columns(0).Caption = "N I S"
Grid1.Columns(1).Caption = "NAMA SISWA / i" Grid1.Columns(2).Caption = "PEND.AKHIR" Grid1.Columns(3).Caption = "STATUS" End Sub
Private Sub Form_Activate()
mdmenuutama.Enabled = False txtjmlsiswa.Text = Rssiswa.RecordCount End Sub
Private Sub txtkodekls_Change() ckode = Trim(txtkodekls.Text) If ckode = Empty Then Exit Sub End If If Rskelas.RecordCount > 0 Then Rskelas.MoveFirst End If If Len(ckode) >= 3 Then
Rskelas.Find ("Kodekls = '" & ckode & "'") If Rskelas.EOF Then
x = MsgBox("Maaf, Kelas dengan Kode <<" & txtkodepkt.Text & ">> tsb belum ada !", 0 + 16, "Konfirmasi")
txtkodekls.Text = "" txtkodekls.SetFocus Exit Sub
Else
txtnamakls.Text = Rskelas!namakls + " / " + Rskelas!Mulaibljr Ada1 = False
End If End If End Sub
Private Sub txtkodepkt_Change() ckode = Trim(txtkodepkt.Text) If ckode = Empty Then Exit Sub End If If Rspaket.RecordCount > 0 Then Rspaket.MoveFirst End If If Len(ckode) >= 3 Then
If Rspaket.EOF Then
x = MsgBox("Maaf, Paket dengan Kode <<" & txtkodepkt.Text & ">> tsb belum ada !", 0 + 16, "Konfirmasi")
txtkodepkt.Text = "" txtkodepkt.SetFocus Exit Sub
Else
txtnamapkt.Text = Rspaket!namapkt + " / " + Rspaket!Lamabljr txtkodekls.Enabled = True
Ada1 = False End If
End If End Sub
Private Sub txtnama_KeyPress(keyascii As Integer) keyascii = Asc(UCase(Chr(keyascii)))
End Sub
Private Sub txtstatus_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then
SendKeys vbTab End If
End Sub
Private Sub txttempat_KeyPress(keyascii As Integer) keyascii = Asc(UCase(Chr(keyascii)))
End Sub
Private Sub Up1_Change() txtthn.Text = up1
Tampildata blankform1 End Sub
Private Sub Form_Load() BukaDatabase blankform1 AturNis tidaksiapisi tutuptombol cmdsimpan.Caption = "&Tambah" cbokelamin.List(0) = "Laki-Laki" cbokelamin.List(1) = "Perempuan" cbostatus.List(0) = "Belum Menikah" cbostatus.List(1) = "Menikah"
cboagama.List(0) = "Islam" cboagama.List(1) = "Kristen" cboagama.List(2) = "Protestan" cboagama.List(3) = "Hindu"
cboagama.List(4) = "Bunda" cboagama.List(5) = "Konghucu" cbopendidikan.List(0) = "SD" cbopendidikan.List(1) = "SMP" cbopendidikan.List(2) = "SMA" cbopendidikan.List(3) = "SMK" cbopendidikan.List(4) = "MA" cbopendidikan.List(5) = "D1" cbopendidikan.List(6) = "D2" cbopendidikan.List(7) = "D3" cbopendidikan.List(8) = "S1"
cbopekerjaan.List(0) = "Belum Ada" cbopekerjaan.List(1) = "Mahasiswa" cbopekerjaan.List(2) = "wiraswasta" up1.Value = Year(Date) dtplahir = Date dtpdaftar = Date txtthn.Text = up1 Tampildata End Sub
Private Sub Form_Unload(Cancel As Integer) Koneksi.Close
End Sub
Private Sub txtkodepkt_keydown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyF1 Then
txtkodepkt.Text = ""
Sql = "Select Namapkt,Kodepkt,lamabljr from tblpaket where kodepkt like '" & txtkodepkt & "%' order by Kodepkt"
Ada = True
frminfo.Caption = " >>> Info Data Paket Tahun " & txtthn & "<<<" frminfo.Show vbModal, Me
Ada = False
txtkodepkt.Text = frminfo.Kode txtkodepkt_Lostfocus
End If
If KeyCode = vbKeyReturn Then SendKeys vbTab
End If End Sub
Private Sub txtkodepkt_Lostfocus() ckode = Trim(txtkodepkt.Text) If ckode = Empty Then Exit Sub
End If
If Rspaket.RecordCount > 0 Then Rspaket.MoveFirst
End If
If Len(ckode) >= 3 Then
Rspaket.Find ("Kodepkt = '" & ckode & "'") If Rspaket.EOF Then
x = MsgBox("Maaf, Paket dengan Kode <<" & txtkodepkt.Text & ">> tsb belum ada !", 0 + 16, "Konfirmasi")
txtkodepkt.Text = "" txtkodepkt.SetFocus Exit Sub
Else
txtnamapkt.Text = Rspaket!namapkt + " / " + Rspaket!Lamabljr txtkodekls.Enabled = True txtkodekls.SetFocus Ada1 = False End If End If End Sub
Private Sub txtkodekls_keydown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyF1 Then
txtkodekls.Text = ""
Sql = "Select Namakls,Kodekls,mulaibljr from tblkelas where kodekls like '" & txtkodekls & "%' order by Kodekls"
Ada = True
frminfo.Caption = " >>> Info Data Kelas Tahun " & txtthn & "<<<" frminfo.Show vbModal, Me
Ada = False
txtkodekls.Text = frminfo.Kode txtkodekls_Lostfocus
End If
If KeyCode = vbKeyReturn Then SendKeys vbTab
End If End Sub
Private Sub txtkodekls_Lostfocus() ckode = Trim(txtkodekls.Text) If ckode = Empty Then Exit Sub
End If
If Rskelas.RecordCount > 0 Then Rskelas.MoveFirst
If Len(ckode) >= 3 Then
Rskelas.Find ("Kodekls = '" & ckode & "'") If Rskelas.EOF Then
x = MsgBox("Maaf, Kelas dengan Kode <<" & txtkodepkt.Text & ">> tsb belum ada !", 0 + 16, "Konfirmasi")
txtkodekls.Text = "" txtkodekls.SetFocus Exit Sub
Else
txtnamakls.Text = Rskelas!namakls + " / " + Rskelas!Mulaibljr Ada1 = False
End If End If
End Sub Public Sub Batal() txtnis.Enabled = True txtnis.BackColor = &H80000005 txtnama.Text = "" txttempat.Text = "" cbokelamin.Text = "" cbostatus.Text = "" cboagama.Text = "" txtasal.Text = "" txtsekarang.Text = "" txttelp.Text = "" cbopendidikan.Text = "" cboagama.Text = "" txtstatus.Text = "" cbopekerjaan.Text = "" txtkodekls.Text = "" txtkodepkt.Text = "" txtnamakls.Text = "" txtnamapkt.Text = "" txtnama.Enabled = False dtpdaftar.Enabled = False txttempat.Enabled = False cbokelamin.Enabled = False cbostatus.Enabled = False cboagama.Enabled = False txtasal.Enabled = False txtsekarang.Enabled = False txttelp.Enabled = False cbopendidikan.Enabled = False cboagama.Enabled = False
cbopekerjaan.Enabled = False txtstatus.Enabled = False txtkodekls.Enabled = False txtkodepkt.Enabled = False cmdsimpan.Enabled = False End Sub
Private Sub CmdSimpan_Click()
If cmdsimpan.Caption = "&Tambah" Then Batal AturNis txtnis.SetFocus Exit Sub End If Validasi
If Valid = True Then If Ada1 = False Then Rssiswa.AddNew isitabelsiswa Rssiswa.Update Else isitabelsiswa Rssiswa.Update End If cmdsimpan.Caption = "&Tambah" Else cmdsimpan.Caption = "&Simpan" End If Rssiswa.Requery Tampildata AturNis txtjmlsiswa.Text = RsTampil.RecordCount End Sub
Private Sub CmdBatal_Click() blankform1 AturNis tidaksiapisi txtnis.Enabled = True txtnis.BackColor = &H80000005 txtnis.SetFocus cmdsimpan.Caption = "&Tambah" tutuptombol End Sub
tutuptombol cmdsimpan.Enabled = True Ada1 = True SiapIsi1 txtnis.Enabled = False txtnis.BackColor = &H80000016 cmdsimpan.Caption = "&Simpan" txtnama.SetFocus End Sub
Private Sub CmdHapus_Click() ckode = Trim(txtnis.Text)
Rspembayaran.Find ("nis='" & ckode & "'"), , adSearchForward, 1 If Not Rspembayaran.EOF Then
x = MsgBox("Data Siswa yang bernama " & txtnama_siswa & " tidak dapat dihapus", 0 + 16, "konfirmasi") blankform1 txtnis.Enabled = True txtnis.SetFocus Exit Sub Else
Y = MsgBox("Benar anda ingin hapus data dengan nama " & txtnama & " ???", vbYesNo + vbQuestion + vbDefaultButton2, "konfirmasi")
Select Case Y Case vbYes
Koneksi.Execute "delete * from tblsiswa where nis ='" & ckode & "'" AturNis Tampildata Case vbNo AturNis cmdkeluar.SetFocus End Select End If CmdBatal_Click Rssiswa.Requery Tampildata End Sub
Private Sub CmdKeluar_Click() Unload Me
mdmenuutama.Enabled = True End Sub
Private Sub Grid1_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then
txtnis.Text = Grid1.Columns(0) txtnis_Lostfocus
End If End If End Sub
Private Sub txtnama_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then
SendKeys vbTab End If
End Sub
Private Sub dtpdaftar_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then
SendKeys vbTab End If
End Sub
Private Sub Txttempat_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then
SendKeys vbTab End If
End Sub
Private Sub dtplahir_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then
SendKeys vbTab End If
End Sub
Private Sub cbokelamin_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then
SendKeys vbTab End If
End Sub
Private Sub cbostatus_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then
SendKeys vbTab End If
End Sub
Private Sub cboagama_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then
SendKeys vbTab End If
End Sub
Private Sub Txtasal_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then
SendKeys vbTab End If
Private Sub Txtsekarang_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then
SendKeys vbTab End If
End Sub
Private Sub Txttelp_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then
SendKeys vbTab End If
End Sub
Private Sub cbopendidikan_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then
SendKeys vbTab End If
End Sub
Private Sub cbopekerjaan_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then
SendKeys vbTab End If
End Sub
Private Sub Txtnis_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyF1 Then
txtnis.Text = ""
Sql = "Select Alamat_Asal,nis,nama from tblsiswa Where thn_masuk='" & txtthn & "'and status_siswa='Aktif' order by nis"
Ada = True
frminfo.Caption = " >>> Info Data Siswa Tahun " & txtthn & " <<<" frminfo.Show vbModal, Me
Ada = False
txtnis.Text = frminfo.Kode txtnis_Lostfocus
End If
If KeyCode = vbKeyReturn Then SendKeys vbTab
End If End Sub
Private Sub txtnis_Lostfocus() ckode = Trim(txtnis.Text) If ckode = Empty Then Exit Sub
End If
Rssiswa.MoveFirst End If
If Len(Trim(txtnis.Text)) <> 8 Then
x = MsgBox("Penginputan nis harus 8 karakter!Anda akan dibantu dengan pengaturan nis otomatis", 0 + 64, "Konfirmasi")
AturNis
txtnis.SetFocus Exit Sub
End If
Set Rssiswa = Nothing
Rssiswa.Open "[tblsiswa] where nis ='" & txtnis & "' and thn_masuk='" & txtthn & "'and nis='" & txtnis & "'", Koneksi, adOpenDynamic, adLockOptimistic
If Rssiswa.EOF Then SiapIsi1 blankform1 txtnama.SetFocus txtstatus.Text = "Aktif" txtstatus.Enabled = False cmdsimpan.Enabled = True cmdsimpan.Caption = "&Simpan" Ada1 = False Else isiformsiswa tidaksiapisi cmdedit.Enabled = True cmdhapus.Enabled = True cmdsimpan.Enabled = True cmdsimpan.Caption = "&Tambah" cmdbatal.SetFocus Ada1 = True End If End Sub
Private Sub AturNis() Set RsTampil = Nothing
RsTampil.Open "Select * From tblsiswa Where Thn_Masuk='" & txtthn & "' order by nis", Koneksi
cnis = "001" + Trim(Right(txtthn.Text, 2)) If RsTampil.RecordCount = 0 Then cno = "001"
Else
RsTampil.MoveLast
Na = Val(Right(RsTampil!nis, 3)) + 1 If Len(Na) = 1 Then
cno = "00" + Trim(Str(Na)) ElseIf Len(Na) = 2 Then cno = "0" + Trim(Str(Na)) ElseIf Len(Na) = 3 Then cno = Trim(Str(Na)) End If
End If
txtnis.Text = cnis + cno End Sub
Private Sub up1_DownClick() AturNis
End Sub
Form Nomor Sertifikat Alumni
Ketik Listing dibawah ini ! Public Ada, Ada1, Valid As Boolean Public Sql, cno, cnama As String
Dim RsTampil As New ADODB.Recordset Private Sub Grid1_Click()
txtno.SetFocus End Sub
Private Sub Grid1_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then
SendKeys vbTab txtno.SetFocus End If
End Sub
Private Sub txttglujian_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then
SendKeys vbTab
cmdproses.Enabled = True cmdproses.SetFocus
End If End Sub
Private Sub txtkode_Click() txtkode.Text = ""
txtnama.Text = "" Tampildata End Sub
Private Sub txtno_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then
SendKeys vbTab
txttglujian.Enabled = True txttglujian.SetFocus
End If End Sub
Private Sub CmdLagi_Click() cmdproses.Enabled = False txtkode.Text = "" txtnama.Text = "" txtno.Text = "" txttglujian.Text = "" txtjml_siswa.Text = "" txtno.Enabled = False txttglujian.Enabled = False Tampildata txtkode.SetFocus
End Sub
Private Sub cmdproses_Click() cno = Grid1.Columns(0) cnama = txtno.Text
Y = MsgBox("Ingin simpan data tersebut ???", vbYesNo + vbQuestion + vbDefaultButton2, "Konfirmasi Kembali")
Select Case Y Case vbYes
Koneksi.Execute "update tblalumni set nosertifikat ='" & cnama & "',tglujian='" & txttglujian & "' where nis='" & cno & "'"
Tampildata txtjml_siswa.Text = RsTampil.RecordCount Grid1.Enabled = True Grid1.SetFocus Case vbNo cmdproses.Enabled = False cmdkeluar.SetFocus txtjml_siswa.Text = RsTampil.RecordCount End Select End Sub
Private Sub Up1_Change() txtthn.Text = Up1
End Sub
Private Sub CmdKeluar_Click() Unload Me
mdmenuutama.Enabled = True End Sub
Private Sub Form_Activate() Grid1.Enabled = False txtno.Enabled = False txttglujian.Enabled = False cmdproses.Enabled = False mdmenuutama.Enabled = False End Sub
Private Sub Form_Load() BukaDatabase
Up1.Value = Year(Date) txtthn.Text = Up1
End Sub
Private Sub Form_Unload(Cancel As Integer) Koneksi.Close
End Sub
Private Sub txtkode_keydown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyF1 Then
txtkode.Text = ""
Sql = "Select Namapkt,Kodepkt,Lamabljr from tblpaket where kodepkt like '" & txtkode & "%' order by Kodepkt"
Ada = True
frminfo.Caption = " >>> Info Data Paket Tahun " & txtthn & "<<<" frminfo.Grid1.Columns(0).Caption = "NAMA PAKET"
frminfo.Grid1.Columns(1).Caption = "KODE PAKET" frminfo.Grid1.Columns(2).Caption = "LAMA BELAJAR" frminfo.Show vbModal, Me
Ada = False
txtkode.Text = frminfo.Kode txtkode_Lostfocus
End If
If KeyCode = vbKeyReturn Then SendKeys vbTab
End If End Sub
Private Sub txtkode_Lostfocus() ckode = Trim(txtkode.Text) If ckode = Empty Then Exit Sub End If If Rspaket.RecordCount > 0 Then Rspaket.MoveFirst End If If Len(ckode) >= 3 Then
Rspaket.Find ("Kodepkt = '" & ckode & "'") If Rspaket.EOF Then
x = MsgBox("Maaf, Paket dengan Kode <<" & txtkode.Text & ">> tsb belum ada !", 0 + 16, "Konfirmasi")
txtkode.Text = "" txtkode.SetFocus Exit Sub
Else
txtnama.Text = Rspaket!namapkt + " / " + "Lama Belajar " + Rspaket!Lamabljr Ada1 = False
cmdproses.Enabled = False Tampildata
txtno.Enabled = True txttglujian.Enabled = True
Grid1.Enabled = True Grid1.SetFocus
txtjml_siswa.Text = RsTampil.RecordCount If RsTampil.RecordCount = 0 Then
x = MsgBox("Maaf. Data madyasiswa yang SELESAI untuk paket " & txtnama & " di tahun " & txtthn & " ... belum ada !!!", 0 + 64, "Pemberitahuan")
txtkode.Text = "" txtnama.Text = "" txtkode.SetFocus Exit Sub End If End If End If End Sub
Private Sub Tampildata() Set RsTampil = Nothing
RsTampil.Open "Select tblalumni.nis,tblsiswa.nama,tblalumni.nosertifikat from " & _ " tblalumni,tblsiswa where tblalumni.kodepkt ='" & txtkode & "' and
tblalumni.nis=tblsiswa.nis and right(tblalumni.tglselesai,4) ='" & txtthn & "' Order by tblalumni.nis", Koneksi
Grid1.Refresh
Set Grid1.DataSource = RsTampil Grid1.Columns(0).Width = 1000 Grid1.Columns(1).Width = 3250 Grid1.Columns(2).Width = 2750 Grid1.Columns(0).Alignment = dbgCenter Grid1.Columns(2).Alignment = dbgCenter Grid1.Columns(0).Caption = "N I S"
Grid1.Columns(1).Caption = "NAMA SISWA" Grid1.Columns(2).Caption = "NO.SERTIFIKAT" End Sub