TAMPILAN DAN LISTING PROGRAM
Tampilan Layar
1. Tampilan Menu Login
3. Tampilan Form Pendaftaran Calon Siswa Baru
5. Tampilan Form Asal Pendaftaran
7. Tampilan Form Profil Sekolah
Listing Program
frmLogin (Code)
Dim ket As String
Private Sub Form_Activate() ket = "" & Label1.Caption txtNU.SetFocus
End Sub
Private Sub Timer1_Timer()
ket = Right(ket, Len(ket) - 1) & Left(ket, 1) Label1.Caption = ket
End Sub
Private Sub cmdBatal_Click()
MsgBox "Anda Akan Keluar?", vbQuestion, "Logout" Unload Me
End Sub
Private Sub cmdLogin_Click()
If txtNU.Text = "ADMIN" And txtPass.Text = "admin" Then MsgBox "Login Berhasil"
frmLogin.Hide MDI_PSB.Show
ElseIf txtNU.Text = "" And txtPass.Text = "" Then
Else
MsgBox " Login Gagal, Silahkan Login Kembali", vbCritical, "Error" txtNU.Text = ""
txtPass.Text = "" txtNU.SetFocus End If
End Sub
MDI_PSB (Code)
Dim ket As String
Private Sub Form_Activate() ket = "" & Picture1.Picture End Sub
Private Sub mAsal_Click() frmAsalSekolah.Show MDI_PSB.Hide End Sub
Private Sub mCalon_Click() cr1.Connect = "dsn=pensisba"
cr1.ReportFileName = App.Path & "\rptCalon.rpt" cr1.WindowState = crptMaximized
cr1.Action = 1 End Sub
Private Sub mHasil_Click() frmHasil.Show
End Sub
Private Sub mKeluar_Click() End
End Sub
Private Sub mPenulis_Click() frmMe.Show
MDI_PSB.Hide End Sub
Private Sub mSekolah_Click() frmSekolah.Show
MDI_PSB.Hide End Sub
Private Sub mSistem_Click() frmPendaftaran.Show
MDI_PSB.Hide End Sub
Private Sub Timer1_Timer()
If Label1.Visible = True Then Label1.Visible = False Else
Label1.Visible = True
End If
frmPendaftaran (Code)
Dim ket As String
Private Sub cmdNext_Click() frmSeleksi.Show
Me.Hide End Sub
Private Sub cmdPrint_Click() cr1.Connect = "dsn=pensisba"
cr1.ReportFileName = App.Path & "\rptForm.rpt" cr1.WindowState = crptMaximized
cr1.Formulas(0) = "ID='" & txtID.Text & "'" cr1.Formulas(1) = "Nama='" & txtNama.Text & "'" cr1.Formulas(2) = "Tmpt='" & txtTmpt.Text & "'" cr1.Formulas(3) = "Tgl='" & DTPicker1.Value & "'" cr1.Formulas(4) = "AR='" & txtRumah.Text & "'" cr1.Formulas(5) = "Asal='" & cboAsal.Text & "'" cr1.Formulas(6) = "AS='" & txtSekolah.Text & "'" cr1.Formulas(7) = "Jml='" & txtJml.Text & "'" cr1.Formulas(8) = "Kepala='" & Text1.Text & "'" cr1.Formulas(9) = "NIP='" & Text2.Text & "'" cr1.Action = 0
End Sub
Private Sub Timer1_Timer()
ket = Right(ket, Len(ket) - 1) & Left(ket, 1) Label11.Caption = ket
End Sub
Private Sub cboAsal_Click()
Set RSAsal = New ADODB.Recordset
koneksi.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\PSB.mdb"
RSAsal.Open "Select * from Asal_Sekolah where Nama_Sekolah='" & cboAsal & "'", koneksi
If Not RSAsal.EOF Then txtRayon = RSAsal!Rayon
txtSekolah = RSAsal!Alamat_Sekolah End If
End Sub
Private Sub cmdInsert_Click()
cmdInsert.Caption = "&I N S E R T"
Private Sub cmdUpdate_Click()
If cmdUpdate.Caption = "&U P D A T E" Then
MsgBox "Data Berhasil Diupdate", vbInformation, "P R O S E S" cmdPrint.Enabled = False
DISABLEOBJ
cmdDelete.Enabled = False cmdInsert.Enabled = True cmdSearch.Enabled = True cmdExit.Enabled = True cmdUpdate.Enabled = False cmdNext.Enabled = True
End If
End Sub
Private Sub cmdDelete_Click() cmdInsert.Enabled = True cmdUpdate.Enabled = False
Y = MsgBox("Yakin Untuk Menghapus Data?", vbOKCancel, "D E L E T E") If Y = vbOK Then
Adodc1.Recordset.Delete
For Each BERSIH In Me.Controls If (TypeOf BERSIH Is TextBox) Then BERSIH.Text = ""
End If Next BERSIH
DTPicker1.Enabled = False cboAsal = ""
txtJml = ""
cmdNext.Enabled = True cmdPrint.Enabled = False Else
Exit Sub End If
Private Sub cmdSearch_Click()
X = InputBox("Cari Data Berdasarkan ID Pendaftaran") Adodc1.Recordset.MoveFirst
Adodc1.Recordset.Find " ID_Pendaftaran = '" & X & "'" If Adodc1.Recordset.EOF Then
Private Sub cmdExit_Click()
Y = MsgBox("Yakin Ingin Keluar dari Form Pendaftaran?", vbQuestion + vbOKCancel, "E X I T")
If Y = vbOK Then Unload Me MDI_PSB.Show Else
Exit Sub
End If
End Sub
Private Sub Form_Activate() cmdPrint.Enabled = False ket = "" & Label11.Caption
Set koneksi = New ADODB.Connection Set RSAsal = New ADODB.Recordset
koneksi.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\PSB.mdb"
RSAsal.Open "Asal_Sekolah", koneksi cboAsal.Clear
Do While Not RSAsal.EOF
cboAsal.AddItem RSAsal!Nama_Sekolah RSAsal.MoveNext
Loop End Sub
Private Sub Form_Load()
Adodc1.RecordSource = "SELECT * from Calon_Siswa_Baru order by ID_Pendaftaran"
Adodc1.Refresh txtID.MaxLength = 6
Set DataGrid1.DataSource = Adodc1 DISABLEOBJ
cmdUpdate.Enabled = False cmdDelete.Enabled = False End Sub
Private Sub DISABLEOBJ()
For Each NOTAMPIL In Me.Controls If (TypeOf NOTAMPIL Is TextBox) Then NOTAMPIL.Enabled = False
End If
Next NOTAMPIL
DTPicker1.Enabled = False cboAsal.Enabled = False
For Each BERSIH In Me.Controls If (TypeOf BERSIH Is TextBox) Then BERSIH.Text = ""
End If Next BERSIH cboAsal = "" End Sub
Private Sub ENABLEOBJ() For Each TAMPIL In Me.Controls If (TypeOf TAMPIL Is TextBox) Then TAMPIL.Enabled = True
End If
Next TAMPIL
End Sub
Private Sub REFRESHDATAGRID()
Adodc1.RecordSource = "SELECT * FROM Calon_Siswa_Baru" Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1 DataGrid1.Refresh
End Sub
Private Sub txtRayon_Change() If txtRayon.Text = "Medan" Then txtJml.Text = Val(txtNU.Text) + 3 Else
txtJml.Text = Val(txtNU.Text) End If
End Sub
frmSeleksi (Code)
Dim tim As String
Private Sub cmdBack_Click() frmPendaftaran.Show
Me.Hide End Sub
Private Sub Timer1_Timer()
tim = Right(tim, Len(tim) - 1) & Left(tim, 1) Label4.Caption = tim
Private Sub cmdHapus_Click()
Y = MsgBox("Yakin Untuk Menghapus Data?", vbOKCancel, "D E L E T E") If Y = vbOK Then
Private Sub cmdKeluar_Click()
Y = MsgBox("Yakin Ingin Keluar dari Form Seleksi?", vbQuestion + vbOKCancel, "E X I T")
Private Sub cmdTampil_Click()
If cmdTampil.Caption = "&S H O W" Then cmdHapus.Enabled = True
cmdTampil.Enabled = False End Sub
Private Sub Form_Activate() tim = "" & Label4.Caption
Set conn = New ADODB.Connection Set RsID = New ADODB.Recordset
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\PSB.mdb"
RsID.Open "Calon_Siswa_Baru", conn cboID.Clear
Do While Not RsID.EOF
cboID.AddItem RsID!ID_Pendaftaran RsID.MoveNext
Loop End Sub
Private Sub Form_Load() cmdProses.Enabled = False cmdHapus.Enabled = False
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = " & App.Path & "\PSB.mdb;Persist Security Info=False"
Adodc1.RecordSource = " select * from Proses order by No_Ujian " Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1 DISABLEOBJ
End Sub
Private Sub cboID_Click() cmdProses.Enabled = True
conn.Open " Provider = Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\PSB.mdb"
RsID.Open " Select ID_Pendaftaran, Nama_Lengkap, Jumlah_Nilai from Calon_Siswa_Baru where ID_Pendaftaran='" & cboID & "'", conn If Not RsID.EOF Then
Private Sub DISABLEOBJ()
For Each NOTAMPIL In Me.Controls If (TypeOf NOTAMPIL Is TextBox) Then NOTAMPIL.Enabled = False
End If
Next NOTAMPIL cboID.Enabled = False
For Each BERSIH In Me.Controls If (TypeOf BERSIH Is TextBox) Then BERSIH.Text = ""
End If Next BERSIH cboAsal = "" End Sub
Private Sub ENABLEOBJ() For Each TAMPIL In Me.Controls If (TypeOf TAMPIL Is TextBox) Then TAMPIL.Enabled = True
End If
cboID.Enabled = True End Sub
Private Sub cmdProses_Click() cboID.SetFocus
cmdProses.Enabled = False
Dim NP As Single, UN As Single, Nilai As Single, Keterangan As String With Adodc1.Recordset
.AddNew
!No_Ujian = cboID.Text !Nama_Siswa = txtNama.Text !Jumlah_Nilai = txtUN.Text !Standar_Nilai = txtSN.Text !Nilai_Psikotes = txtPsikotes.Text
cmdHapus.Enabled = True DataGrid1.Refresh
Call NilaiPsikotesdanUN(NP, UN, Nilai) Keterangan = ket(NP, UN, Nilai)
TampilKet Keterangan
!Keterangan = txtKet.Text
.Update End With cboID.Text = "" txtNama.Text = "" txtUN.Text = "" txtSN.Text = "" txtPsikotes.Text = ""
Sub NilaiPsikotesdanUN(ByRef NP As Single, ByRef UN As Single, Nilai As Single) NP = (10 / 100) * Val(txtPsikotes.Text)
UN = (90 / 100) * Val(txtUN.Text) Nilai = Val(txtSN.Text)
End Sub
Function ket(ByVal NP As Single, ByVal UN As Single, ByVal Nilai As Single) As String
If (NP + UN) >= Nilai Then ket = "LULUS"
Else
ket = "TIDAK LULUS" End If
End Function
Sub TampilKet(ByVal Keterangan As String) txtKet.Text = Keterangan
End Sub
frmAsalSekolah (Code)
Dim ket As String
Private Sub Form_Activate() ket = "" & Label4.Caption End Sub
Private Sub Timer1_Timer()
ket = Right(ket, Len(ket) - 1) & Left(ket, 1) Label4.Caption = ket
Private Sub Form_Load() Adodc1.Visible = False
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = " & App.Path & "\PSB.mdb;Persist Security Info=False"
Adodc1.RecordSource = "SELECT * from Asal_Sekolah" Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1 DISABLEOBJ
cboRayon.AddItem "Medan"
cboRayon.AddItem "Bukan Medan" cmdUpdate.Enabled = False
cmdDelete.Enabled = False End Sub
Private Sub cmdInsert_Click()
If cmdInsert.Caption = "&I N S E R T" Then ENABLEOBJ
txtNS.SetFocus
cmdInsert.Caption = "S &A V E" Else
With Adodc1.Recordset .AddNew
!Nama_Sekolah = txtNS.Text !Rayon = cboRayon.Text !Alamat_Sekolah = txtAS.Text .Update
End With
cmdInsert.Caption = "&I N S E R T"
MsgBox "Data Berhasil Disimpan", vbInformation, "P R O S E S" DISABLEOBJ
Private Sub cmdUpdate_Click()
If cmdUpdate.Caption = "&U P D A T E" Then cmdUpdate.Caption = "&S A V E"
ENABLEOBJ Else
With Adodc1.Recordset !Nama_Sekolah = txtNS.Text !Rayon = cboRayon.Text !Alamat_Sekolah = txtAS.Text .Update
End With
MsgBox "Data Berhasil Diupdate", vbInformation, "P R O S E S" DISABLEOBJ
cmdUpdate.Caption = "&U P D A T E" cmdDelete.Enabled = False
cmdInsert.Enabled = True cmdSearch.Enabled = True cmdExit.Enabled = True cmdUpdate.Enabled = False End If
End Sub
Private Sub cmdDelete_Click() cmdInsert.Enabled = True cmdUpdate.Enabled = False
Y = MsgBox("Yakin Untuk Menghapus Data?", vbOKCancel, "D E L E T E") If Y = vbOK Then
Adodc1.Recordset.Delete
For Each BERSIH In Me.Controls If (TypeOf BERSIH Is TextBox) Then BERSIH.Text = ""
cboRayon = ""
Private Sub cmdSearch_Click()
X = InputBox("Cari Data Berdasarkan Nama Sekolah") Adodc1.Recordset.MoveFirst
Adodc1.Recordset.Find " Nama_Sekolah = '" & X & "'" If Adodc1.Recordset.EOF Then
MsgBox "Data Tidak Ditemukan, Input Nama Sekolah dengan Benar!", vbCritical, "Gagal"
Exit Sub Else
MsgBox "Data Ditemukan" With Adodc1.Recordset txtNS.Text = !Nama_Sekolah cboRayon.Text = !Rayon txtAS.Text = !Alamat_Sekolah End With
ENABLEOBJ
cmdInsert.Enabled = False cmdUpdate.Enabled = True cmdDelete.Enabled = True Exit Sub
End If End Sub
Private Sub cmdExit_Click()
If Y = vbOK Then Unload Me MDI_PSB.Show Else
Exit Sub End If End Sub
Private Sub DISABLEOBJ()
For Each NOTAMPIL In Me.Controls If (TypeOf NOTAMPIL Is TextBox) Then NOTAMPIL.Enabled = False
End If
Next NOTAMPIL
cboRayon.Enabled = False
For Each BERSIH In Me.Controls If (TypeOf BERSIH Is TextBox) Then BERSIH.Text = ""
End If Next BERSIH cboRayon = "" End Sub
Private Sub ENABLEOBJ() For Each TAMPIL In Me.Controls If (TypeOf TAMPIL Is TextBox) Then TAMPIL.Enabled = True
End If
Next TAMPIL
Private Sub REFRESHDATAGRID()
Adodc1.RecordSource = "SELECT * FROM Asal_Sekolah" Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1 DataGrid1.Refresh
End Sub
frmHasil (Code)
Dim tim As String
Dim cn As New ADODB.Connection Dim rs As New ADODB.Recordset
Private Sub cboTampil_Click() Set rs = New ADODB.Recordset rs.CursorLocation = adUseClient
rs.Open "select * from Proses where Keterangan='" & cboTampil & "'", cn, adOpenKeyset
If rs.RecordCount <> 0 Then Set DataGrid1.DataSource = rs
Else Call db1 Exit Sub End If End Sub
Private Sub cmdCetak_Click() If cboTampil.Text = "LULUS" Then
cr1.SelectionFormula = "{Proses.Keterangan}= '" & cboTampil.Text & "'" cr1.WindowState = crptMaximized
cr1.Formulas(0) = "KepSek='" & Text1.Text & "'" cr1.Formulas(1) = "NIP='" & Text2.Text & "'" cr1.Action = 0
ElseIf cboTampil.Text = "TIDAK LULUS" Then cr1.ReportFileName = App.Path & "\rptKelulusan.rpt" cr1.DiscardSavedData = True
cr1.SelectionFormula = "{Proses.Keterangan}= '" & cboTampil.Text & "'" cr1.WindowState = crptMaximized
cr1.Formulas(0) = "KepSek='" & Text1.Text & "'" cr1.Formulas(1) = "NIP='" & Text2.Text & "'" cr1.Action = 0
Else
On Error Resume Next With cr2
.Reset
.Destination = crptToWindow
.ReportFileName = App.Path & "\rptKelulusan2.rpt" .DiscardSavedData = True
.WindowState = crptMaximized
cr1.Formulas(0) = "KepSek='" & Text1.Text & "'" cr1.Formulas(1) = "NIP='" & Text2.Text & "'" .WindowShowPrintBtn = True
cr2.Action = 0 End With End If End Sub
Private Sub cmdExit_Click()
If Y = vbOK Then Unload Me MDI_PSB.Show Else
Exit Sub End If End Sub
Private Sub Form_Activate() tim = "" & Label1.Caption cboTampil.SetFocus End Sub
Private Sub Form_Load()
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = " & App.Path & "\PSB.mdb;Persist Security Info=False"
Adodc1.RecordSource = "SELECT * from Proses order by Jumlah_Nilai desc, Nilai_Psikotes desc"
Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1
cboTampil.AddItem "LULUS"
cboTampil.AddItem "TIDAK LULUS" cboTampil.AddItem "SEMUA"
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\PSB.mdb"
Call isicombo End Sub
Sub isicombo()
Set rs = New ADODB.Recordset
Do While rs.EOF = False rs.MoveNext
Loop
Else Exit Sub End If End Sub
Sub db1()
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = " & App.Path & "\PSB.mdb;Persist Security Info=False"
Adodc1.RecordSource = "SELECT * from Proses" Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1 End Sub
Private Sub Timer1_Timer()
tim = Right(tim, Len(tim) - 1) & Left(tim, 1) Label1.Caption = tim