L1. Form Pengisian Password untuk Mengakses Software
L3. Form Input dan Update Soal Ujian Seleksi
L4. Setting Database Soal Ujian
L6. Form Soal Ujian untuk Peserta
L9. Output Laporan Hasil Ujian Seleksi pada Layar
L10. Form Pengisian Password untuk Mengakses Software
Dim Db As Database Dim Rs As Recordset
Private Sub Command1_Click()
Rs.Seek "=", Text1.Text, Text2.Text If Rs.NoMatch Then
MenuSeleksi.Show
MenuSeleksi.StatusBar1.Panels(5) = Text1.Text Unload Me
Else
MsgBox "User atau Password Salah!" End If
End Sub
Private Sub Command2_Click() End
End Sub
Private Sub Form_Load()
Text2.PasswordChar = "*"
Set Rs = Db.OpenRecordset("Pass") Rs.Index = "Kode"
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then Text2.SetFocus End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then
Rs.Seek "=", Text1.Text, Text2.Text If Not Rs.NoMatch Then
MenuSeleksi.Show
MenuSeleksi.StatusBar1.Panels(5) = Text1.Text Unload Me
Else
MsgBox "User atau Password Salah!" End If
End If End Sub
L11. Menu Utama
Dim Db As Database Dim Rs As Recordset
Private Sub Ep_Click()
y = InputBox("Masukkan User Name yang Akan Di Edit :", "Input") yus = InputBox("Masukkan Password yang Akan Di Edit :", "Input") Rs.Seek "=", y, yus
If Rs.NoMatch Then
MsgBox "Password tidak ada...!" Else
y = InputBox("Masukkan User Name yang Baru :", "Input") yus = InputBox("Masukkan Password yang Baru :", "Input") Rs.Edit
Rs!nama = y Rs!kode = yus Rs.Update End If End Sub
Private Sub Fdcdk_Click() FCetakAll.Show
Private Sub FDus_Click() FSoal.Show
End Sub
Private Sub Fs_Click() End
End Sub
Private Sub ip_Click()
y = InputBox("Masukkan User Name :", "Input") yus = InputBox("Masukkan Password :", "Input") Rs.Seek "=", y, yus
If Rs.NoMatch Then Rs.AddNew Rs!nama = y Rs!kode = yus Rs.Update Else
MsgBox "Password telah ada...!" End If
End Sub
Private Sub MDIForm_Load()
Set Db = OpenDatabase(App.Path & "\Seleksi.mdb") Set Rs = Db.OpenRecordset("Pass")
Rs.Index = ("Kode")
StatusBar1.Panels(4).Text = Format(Date, "dd mmmm yyyy") StatusBar1.Panels(5).ToolTipText = "Operator"
StatusBar1.Panels(4).ToolTipText = "Tanggal" StatusBar1.Panels(3).ToolTipText = "Waktu" End Sub
Private Sub Pn_Click() FNilai.Show
End Sub
Private Sub Timer1_Timer()
L12. Form Input dan Update Soal Ujian Seleksi
Dim Db As Database Dim Rs As Recordset Dim R As Integer
Private Sub Command1_Click() R = 1
Clear
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text) Text1.SetFocus
End Sub
Private Sub Command2_Click() R = 2
Text1.SetFocus End Sub
Private Sub Command3_Click() If R = 0 Then
Text1.SetFocus R = 3
ElseIf R = 3 Then Rs.Delete Clear R = 0 End If End Sub
Private Sub Command4_Click() Clear
End Sub
Private Sub Command5_Click() If R = 1 Then
Rs.AddNew
Rs!nosoal = Text1.Text Rs!Nama = Text2.Text Rs!jawab = Text3.Text Rs.Update
ElseIf R = 2 Then Rs.Edit
Rs.Update Else
MsgBox "Pilih Tambah, Edit or Hapus !" Text1.SetFocus
End If Clear End Sub
Private Sub Command6_Click() Unload Me
End Sub
Private Sub Form_Load()
Set Db = OpenDatabase(App.Path & "\Seleksi.mdb") Set Rs = Db.OpenRecordset("Soal")
Rs.Index = ("NoSoal") R = 0
Rs.MoveLast
Text1.Text = Rs!nosoal Text2.Text = Rs!Nama Text3.Text = Rs!jawab Me.Height = 5910 Me.Width = 8865 End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then
If R = 1 Then
Rs.Seek "=", Text1.Text If Rs.NoMatch Then Text2.SetFocus Else
MsgBox "Data Soal Telah Ada !" Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text) Text1.SetFocus
End If
ElseIf R = 2 Then
Rs.Seek "=", Text1.Text If Rs.NoMatch Then
MsgBox "Data Soal Tidak Ada !" Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text) Text1.SetFocus
Else
Text2.SelStart = 0
Text2.SelLength = Len(Text2.Text) Text2.SetFocus
End If
ElseIf R = 3 Then
Rs.Seek "=", Text1.Text If Rs.NoMatch Then
MsgBox "Data Soal Tidak Ada !" Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text) Text1.SetFocus
Else
Text2.Text = Rs!Nama Text3.Text = Rs!jawab Command3.SetFocus End If
Else
MsgBox "Pilih Apa yang Akan Anda Lakukan !" Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text) Text1.SetFocus
End If End If End Sub
Sub Clear() Text2.Text = "" Text3.Text = "" Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text) Text1.SetFocus
End Sub
Private Sub Text3_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then Command5.SetFocus End Sub
L13. Setting Database Soal Ujian
Private Sub Check1_Click() If Check1.Value = 1 Then
Text1.Text = "C:\baru\data\Server\seleksi.mdb" Y = Text1.Text
Else
End If
Text2.SetFocus End Sub
Private Sub Command1_Click() If Check1.Value = 1 Then
Text1.Text = "C:\baru\data\Server\seleksi.mdb" Y = Text1.Text
Else
Y = (Text1.Text) End If
Text2.SetFocus
If Text2.Text = "" Then MsgBox "Waktu !" Text2.SetFocus Else
T = Val(Text2.Text)
FrmInput.Text3.Text = FrmSeting.Text2.Text Unload Me
FrmInput.Show End If
End Sub
Private Sub Command2_Click() End
End Sub
Private Sub Command3_Click()
CommonDialog1.Filter = "File Database (*.mdb)|*.mdb" CommonDialog1.ShowOpen
Text1.Text = CommonDialog1.FileName End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then Command1.SetFocus End Sub
L14. Input
Dim Db As ADODB.Connection Dim RS As ADODB.Recordset
Private Sub Form_Load()
Set RS = New ADODB.Recordset
Db.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Y & "" '\baru\data\seleksi.mdb" '\test\seleksi.mdb"
'Db.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=\\" & Y & "\SharedDocs\seleksi.mdb"
'Db.Open "DRIVER={Microsoft Access Driver
(*.mdb)};DBQ=\\169.254.3.105\SharedDocs\seleksi.mdb"
'RS.Open "select * from siswa", Db, adOpenDynamic, adLockBatchOptimistic Command1.Enabled = False
End Sub
Private Sub Command1_Click()
FrmSoal.Text7.Text = Text3.Text FrmSoal.Text1.Text = Text1.Text FrmSoal.Text2.Text = Text2.Text Unload Me
FrmSoal.Show End Sub
Private Sub Command2_Click() Unload Me
FrmSeting.Show End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then
RS.Open "select nama from siswa where nopeserta='" & Text1.Text & "'", Db, adOpenDynamic, adLockBatchOptimistic
On Error GoTo Yy Text2.Text = RS!nama RS.Close
Command1.Enabled = True Command1.SetFocus End If
Exit Sub
Yy:
Yu = MsgBox("Data anda tidak dikenali!", vbOKOnly & vbCritical, "Perhatikan No Peserta!::.")
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text) Text1.SetFocus
L15. Soal
Dim Db As ADODB.Connection Dim RS As ADODB.Recordset Dim Rs2 As ADODB.Recordset Dim Y1, T1 As Integer
Private Sub Command1_Click() On Error GoTo Yt
'Rs2.Open "select * from nilai where nopeserta='" & Text1.Text & "' and nosoal='" & Text3.Text & "'", Db, adOpenDynamic, adLockBatchOptimistic If RS.BOF = True Then
RS.MoveFirst ' Rs2.MoveFirst Else
RS.MovePrevious ' Rs2.MovePrevious End If
Text3.Text = RS!nosoal Text4.Text = RS!nama ' Text5.Text = Rs2!jawaban ' Rs2.Close
Exit Sub Yt:
'Rs.MovePrevious RS.MoveFirst
Text3.Text = RS!nosoal Text4.Text = RS!nama ' Text5.Text = Rs2!jawaban ' Rs2.Close
End Sub
Private Sub Command2_Click() On Error GoTo Yt If RS.EOF = True Then RS.MoveLast
Else
RS.MoveNext End If
Text3.Text = RS!nosoal Text4.Text = RS!nama Exit Sub
Yt:
RS.MoveLast
End Sub
Private Sub Command3_Click()
Dim Nil, N, Yu, Yt, T, Tot, Yy, Mno, Mbaris As Integer Timer1.Interval = 0
Rs2.Open "select * from nilai where nopeserta='" & Text1.Text & "'", Db, adOpenDynamic, adLockBatchOptimistic
N = 0 Nil = 0 T = 0 Yu = 0
'Yt = Rs2.RecordCount 'MsgBox Yt
'RS.Index = "nom" 'Rs2.Index = "nosoal" RS.MoveFirst
Rs2.MoveFirst MsgBox RS!nosoal MsgBox Rs2!nosoal Yy = 0
Do
Yy = Yy + 1
'RS.Seek "=", Rs2!nosoal Y = RS!nosoal
T = Rs2!nosoal
If Not Y <> T Then 'Rs2!nosoal <> RS!nosoal Then MsgBox "No Tak Sama 2"
End Else
MsgBox "Ada"
If RS!jawab = Rs2!jawaban Then MsgBox "sama 2"
N = 1 T = 10 * N Else
MsgBox "tak sama 2" N = 0
End If End If
Nil = Nil + N
Db.Execute "update Nilai set nilai='" & N & "',totnilai='" & T & "' where nopeserta='" & Text1.Text & "'"
'Db.Execute "insert into nilai(nilai,totnilai) values ('" & N & "','" & T & "')" 'RS.Edit
'RS.Update RS.MoveNext Rs2.MoveNext Loop Until RS.EOF MsgBox Nil
End End Sub
Private Sub Form_Load()
Text8.Text = Format(Date, "dd/mm/yy") Text6.Text = Format(Time, "hh:mm:ss") A = Left(Text6.Text, 2)
B = Mid(Text6.Text, 4, 2) C = Right(Text6.Text, 2) B = Val(B) + Val(T) If B >= 60 Then
For I = 1 To Val(T) Step 60 D = D + 1
Next B = "00" End If
'MsgBox (A & " A JAM") A = A + D
If A >= 24 Then A = "01" End If
'MsgBox A & " A JAM BARU" 'MsgBox B & " B MENIT" 'MsgBox C & " C DETIK" 'MsgBox D & " D TAMBAH" 'MsgBox T & " T WAKTU" Timer1.Interval = 10
Set Db = New ADODB.Connection Set RS = New ADODB.Recordset Set Rs2 = New ADODB.Recordset
'Db.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=\\" & Y & "\SharedDocs\seleksi.mdb"
Db.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Y & "" '\TEST\seleksi.mdb"
'Db.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=C:\Documents and Settings\User\My Documents\Data buku.mdb"
RS.Open "select * from soal", Db, adOpenDynamic, adLockBatchOptimistic 'Rs2.Open "select * from nilai", Db, adOpenDynamic, adLockBatchOptimistic RS.MoveFirst
' MsgBox RS.Fields(0).Value ' RS.MoveNext
'Loop Until RS.EOF Text3.Text = RS!nosoal Text4.Text = RS!nama 'RS.Close
Y1 = 0 T1 = 0 End Sub
Private Sub Text5_KeyPress(KeyAscii As Integer) On Error GoTo Yt
If KeyAscii = 13 Then
'Db.Execute "update peserta set nosoal='" & Text3.Text & "',jawab='" & _ 'Text5.Text & "' where nopeserta='" & Text1.Text & "'"
'Rs2.Open "select * from nilai where nopeserta='" & Text1.Text & "' and nosoal='" & Text3.Text & "'", Db, adOpenDynamic, adLockBatchOptimistic
'If Rs2!jawaban = "" Then
' Db.Execute "insert into nilai(nopeserta,nosoal,jawaban,tgl) values ('" & Text1.Text & "','" & Text3.Text & "','" & Text5.Text & "','" & Text8.Text & "')" ' Where nilai(jawaban )=('""')"
' RS.Open "select * from soal", Db, adOpenDynamic, adLockBatchOptimistic 'Else
Db.Execute "delete from nilai where(nopeserta='" & Text1.Text & "' and nosoal='" & Text3.Text & "')"
Db.Execute "insert into nilai(nopeserta,nosoal,jawaban,tgl) values ('" & Text1.Text & "','" & Text3.Text & "','" & Text5.Text & "','" & Text8.Text & "')"
'Db.Execute "update nilai set nopeserta='" & Text1.Text & "',nosoal='" & _ 'Text3.Text & "',jawaban='" & _
'Text5.Text & "',tgl='" & Text8.Text & "'" 'End If
'Do
'Text3.Text = Rs!nosoal 'Text4.Text = Rs!nama 'Rs.MoveNext
'Loop Until Rs.EOF If RS.EOF Then RS.MoveLast
Text3.Text = RS!nosoal Text4.Text = RS!nama Else
RS.MoveNext
Text4.Text = RS!nama End If
'Text3.Text = Rs!nosoal 'Text4.Text = Rs!nama Text5.SelStart = 0
Text5.SelLength = Len(Text5.Text) Text5.SetFocus 'Rs2.Close End If Exit Sub Yt: RS.MoveLast
Text3.Text = RS!nosoal Text4.Text = RS!nama Text5.SelStart = 0
Text5.SelLength = Len(Text5.Text) Text5.SetFocus
End Sub
Private Sub Timer1_Timer()
Text6.Text = Format(Time, "hh:mm:ss")
If Val(C) = Right(Text6.Text, 2) And Val(B) = Mid(Text6.Text, 4, 2) And Val(A) = Left(Text6.Text, 2) Then
MsgBox "Time Is Up" Beep
Timer1.Interval = 0
Debug.Print A, ":", B, ":", C
'Db.Execute "select * from nilai where nopeserta='" & Text1.Text & "'" 'RS.MoveFirst
'Rs2.MoveFirst 'Do
'If Rs2!nosoal <> RS!nosoal Then ' If Rs2!jawaban = RS!jawab Then ' Y1 = Y1 + 1
' RS.MoveNext ' Rs2.MoveNext ' Else
' MsgBox "Beda 1" ' RS.Close
' Rs2.Close ' End ' End If ' Else
' MsgBox "Beda 2" ' RS.Close
' End ' End If T1 = T1 + 1
' Loop Until Rs2.EOF ' MsgBox " '" & T & "'" RS.Close