VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form frmNilai 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Nilai Siswa - [SMP Negeri 2] Medan.."
   ClientHeight    =   4695
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   8745
   BeginProperty Font 
      Name            =   "Tahoma"
      Size            =   8.25
      Charset         =   0
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   4695
   ScaleWidth      =   8745
   Begin VB.TextBox LblPelajaran 
      Enabled         =   0   'False
      Height          =   285
      Left            =   4440
      TabIndex        =   33
      Top             =   1680
      Width           =   4215
   End
   Begin VB.TextBox LblBidang 
      Enabled         =   0   'False
      Height          =   285
      Left            =   1200
      TabIndex        =   32
      Top             =   1680
      Width           =   1695
   End
   Begin VB.TextBox LblPegawai 
      Enabled         =   0   'False
      Height          =   285
      Left            =   4440
      TabIndex        =   31
      Top             =   960
      Width           =   4215
   End
   Begin VB.TextBox LblKelas 
      Enabled         =   0   'False
      Height          =   285
      Left            =   1200
      TabIndex        =   30
      Top             =   960
      Width           =   1695
   End
   Begin VB.TextBox txtCatatan 
      Enabled         =   0   'False
      Height          =   285
      Left            =   3960
      TabIndex        =   24
      Top             =   2400
      Width           =   4695
   End
   Begin VB.TextBox txtHuruf 
      Enabled         =   0   'False
      Height          =   285
      Left            =   1200
      TabIndex        =   22
      Top             =   2400
      Width           =   2655
   End
   Begin MSComctlLib.ListView Lv1 
      Height          =   1335
      Left            =   120
      TabIndex        =   21
      Top             =   2760
      Width           =   8535
      _ExtentX        =   15055
      _ExtentY        =   2355
      View            =   3
      LabelEdit       =   1
      LabelWrap       =   -1  'True
      HideSelection   =   -1  'True
      FullRowSelect   =   -1  'True
      GridLines       =   -1  'True
      _Version        =   393217
      ForeColor       =   -2147483640
      BackColor       =   -2147483643
      BorderStyle     =   1
      Appearance      =   1
      NumItems        =   10
      BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
         Text            =   "No."
         Object.Width           =   882
      EndProperty
      BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
         SubItemIndex    =   1
         Text            =   "NIS"
         Object.Width           =   2117
      EndProperty
      BeginProperty ColumnHeader(3) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
         SubItemIndex    =   2
         Text            =   "Nama Siswa"
         Object.Width           =   2540
      EndProperty
      BeginProperty ColumnHeader(4) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
         SubItemIndex    =   3
         Text            =   "Kode Bidang"
         Object.Width           =   2540
      EndProperty
      BeginProperty ColumnHeader(5) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
         SubItemIndex    =   4
         Text            =   "Bidang Studi"
         Object.Width           =   3175
      EndProperty
      BeginProperty ColumnHeader(6) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
         SubItemIndex    =   5
         Text            =   "Kode Pelajaran"
         Object.Width           =   2540
      EndProperty
      BeginProperty ColumnHeader(7) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
         SubItemIndex    =   6
         Text            =   "Pelajaran"
         Object.Width           =   2822
      EndProperty
      BeginProperty ColumnHeader(8) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
         Alignment       =   1
         SubItemIndex    =   7
         Text            =   "Nilai"
         Object.Width           =   1764
      EndProperty
      BeginProperty ColumnHeader(9) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
         SubItemIndex    =   8
         Text            =   "Huruf"
         Object.Width           =   2540
      EndProperty
      BeginProperty ColumnHeader(10) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
         SubItemIndex    =   9
         Text            =   "Catatan"
         Object.Width           =   2540
      EndProperty
   End
   Begin VB.ComboBox CmbPelajaran 
      Enabled         =   0   'False
      Height          =   315
      Left            =   3000
      TabIndex        =   19
      Top             =   1680
      Width           =   1335
   End
   Begin VB.CommandButton cmdHapus 
      BackColor       =   &H00D8E9EC&
      Caption         =   "&Hapus"
      Enabled         =   0   'False
      Height          =   405
      Left            =   6720
      TabIndex        =   18
      Top             =   4200
      Width           =   945
   End
   Begin VB.CommandButton cmdTutup 
      BackColor       =   &H00D8E9EC&
      Caption         =   "&Tutup"
      Height          =   405
      Left            =   7680
      TabIndex        =   17
      Top             =   4200
      Width           =   945
   End
   Begin VB.CommandButton cmdEdit 
      BackColor       =   &H00D8E9EC&
      Caption         =   "&Edit"
      Enabled         =   0   'False
      Height          =   405
      Left            =   5760
      TabIndex        =   16
      Top             =   4200
      Width           =   945
   End
   Begin VB.CommandButton cmdSimpan 
      BackColor       =   &H00D8E9EC&
      Caption         =   "&Simpan"
      Enabled         =   0   'False
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   405
      Left            =   4800
      TabIndex        =   15
      Top             =   4200
      Width           =   945
   End
   Begin VB.CommandButton cmdTambah 
      BackColor       =   &H00D8E9EC&
      Caption         =   "&Tambah"
      Height          =   405
      Left            =   3840
      TabIndex        =   14
      Top             =   4200
      Width           =   945
   End
   Begin VB.TextBox txtTugas 
      Enabled         =   0   'False
      Height          =   285
      Left            =   120
      TabIndex        =   13
      Top             =   2400
      Width           =   975
   End
   Begin VB.ComboBox CmbBidang 
      Enabled         =   0   'False
      Height          =   315
      Left            =   120
      TabIndex        =   10
      Top             =   1680
      Width           =   975
   End
   Begin VB.ComboBox cmbKelas 
      Enabled         =   0   'False
      Height          =   315
      Left            =   130
      TabIndex        =   8
      Top             =   960
      Width           =   975
   End
   Begin VB.ComboBox CmbNIS 
      Enabled         =   0   'False
      Height          =   315
      Left            =   3000
      TabIndex        =   6
      Top             =   960
      Width           =   1335
   End
   Begin VB.TextBox Text2 
      Enabled         =   0   'False
      Height          =   285
      Left            =   960
      MaxLength       =   4
      TabIndex        =   2
      Top             =   360
      Width           =   495
   End
   Begin VB.TextBox Text1 
      Enabled         =   0   'False
      Height          =   285
      Left            =   120
      MaxLength       =   4
      TabIndex        =   1
      Top             =   360
      Width           =   495
   End
   Begin VB.ComboBox cmbSemester 
      Enabled         =   0   'False
      Height          =   315
      ItemData        =   "frmNilai.frx":0000
      Left            =   1560
      List            =   "frmNilai.frx":000A
      TabIndex        =   0
      Top             =   360
      Width           =   1095
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackColor       =   &H8000000A&
      Caption         =   "Pelajaran:"
      Height          =   195
      Index           =   8
      Left            =   4440
      TabIndex        =   29
      Top             =   1440
      Width           =   4215
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackColor       =   &H8000000A&
      Caption         =   "Bidang Studi"
      Height          =   195
      Index           =   7
      Left            =   1200
      TabIndex        =   28
      Top             =   1440
      Width           =   1695
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackColor       =   &H8000000A&
      Caption         =   "Kelas:"
      Height          =   195
      Index           =   6
      Left            =   1200
      TabIndex        =   27
      Top             =   720
      Width           =   1695
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackColor       =   &H8000000A&
      Caption         =   "Nama Siswa"
      Height          =   195
      Index           =   5
      Left            =   4440
      TabIndex        =   26
      Top             =   720
      Width           =   4215
   End
   Begin VB.Label Label6 
      AutoSize        =   -1  'True
      BackColor       =   &H8000000A&
      Caption         =   "Catatan:"
      Height          =   195
      Index           =   2
      Left            =   3960
      TabIndex        =   25
      Top             =   2160
      Width           =   4695
   End
   Begin VB.Label Label6 
      AutoSize        =   -1  'True
      BackColor       =   &H8000000A&
      Caption         =   "Huruf:"
      Height          =   195
      Index           =   1
      Left            =   1200
      TabIndex        =   23
      Top             =   2160
      Width           =   2625
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackColor       =   &H8000000A&
      Caption         =   "Kode Pelajaran:"
      Height          =   195
      Index           =   4
      Left            =   3000
      TabIndex        =   20
      Top             =   1440
      Width           =   1335
   End
   Begin VB.Label Label6 
      AutoSize        =   -1  'True
      BackColor       =   &H8000000A&
      Caption         =   "Nilai Tugas:"
      Height          =   195
      Index           =   0
      Left            =   120
      TabIndex        =   12
      Top             =   2160
      Width           =   975
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackColor       =   &H8000000A&
      Caption         =   "Kode Bidang:"
      Height          =   195
      Index           =   2
      Left            =   135
      TabIndex        =   11
      Top             =   1440
      Width           =   975
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackColor       =   &H8000000A&
      Caption         =   "Kode Kelas:"
      Height          =   195
      Index           =   0
      Left            =   130
      TabIndex        =   9
      Top             =   720
      Width           =   975
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackColor       =   &H8000000A&
      Caption         =   "NIS:"
      Height          =   195
      Index           =   1
      Left            =   3000
      TabIndex        =   7
      Top             =   720
      Width           =   1335
   End
   Begin VB.Label Label4 
      Alignment       =   2  'Center
      AutoSize        =   -1  'True
      Caption         =   "/"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   300
      Left            =   720
      TabIndex        =   5
      Top             =   360
      Width           =   105
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackColor       =   &H8000000A&
      Caption         =   "Tahun Ajaran:"
      Height          =   195
      Index           =   3
      Left            =   135
      TabIndex        =   4
      Top             =   120
      Width           =   1275
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      BackColor       =   &H8000000A&
      Caption         =   " Semester"
      Height          =   195
      Index           =   2
      Left            =   1560
      TabIndex        =   3
      Top             =   120
      Width           =   1095
   End
End
Attribute VB_Name = "frmNilai"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Sub cmbBidang_Click()
        If cmbBidang.Text <> "" Then
        
        For i = 1 To Lv1.ListItems.Count
                    If cmbBidang.Text = Lv1.ListItems(i).SubItems(3) Then
                        MsgBox "Kode Bidang Sudah Ada pada daftar....", vbExclamation, "Ooops..."
                        cmbBidang.SetFocus
                        Exit Sub
                    End If
                Next
                 ' Kata = "Select * from master where [Tahun Ajaran]='" & Text1.Text & "/" & Text2.Text & "' And Semester='" & _
                 ' cmbSemester.Text & "' And [Kode Kelas]='" & cmbKelas.Text & "' And NIS='" & CmbNIS.Text & "' And [Kode Bidang]='" & _
                 ' cmbBidang.Text & "'"
                 ' Set TBidang = New ADODB.Recordset
                 '   TBidang.Open Kata, Datasiswa, adOpenDynamic, adLockPessimistic
                 '   If TBidang.EOF Then
                 '       TBidang.Close
                 '       Set TBidang = Nothing
                        Me.MousePointer = 11
                        Kata = "Select * from Bidang where [kode Bidang]='" & cmbBidang.Text & "'"
                        Set TNilai = New ADODB.Recordset
                            TNilai.Open Kata, Datasiswa, adOpenDynamic, adLockPessimistic
                            If TNilai.EOF Then
                                TNilai.Close
                                Set TNilai = Nothing
                                Me.MousePointer = 1
                                MsgBox "Bidang = " & cmbBidang.Text & " tidak terdaftar...", vbExclamation
                                cmbBidang.SetFocus
                                Exit Sub
                            End If
                            LblBidang = TNilai![Bidang Studi]
                            TNilai.Close
                            Set TNilai = Nothing
                            DaftarPelajaran
                            cmbBidang.Enabled = False
                            CmbPelajaran.Enabled = True
                            CmbPelajaran.SetFocus
                            Me.MousePointer = 1
                  '      Else
                   '         MsgBox "Data Sudah pernah di simpan...", vbInformation
                    '        Semula
                     '       TBidang.Close
                      '      Set TBidang = Nothing
                       '     Me.MousePointer = 1
                       ' End If
        End If
End Sub

Private Sub CmbBidang_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
    If cmbBidang.Text <> "" Then
        Me.MousePointer = 11
        Kata = "Select * from Bidang where [kode Bidang]='" & cmbBidang.Text & "'"
        Set TNilai = New ADODB.Recordset
            TNilai.Open Kata, Datasiswa, adOpenDynamic, adLockPessimistic
            If TNilai.EOF Then
                TNilai.Close
                Set TNilai = Nothing
                Me.MousePointer = 1
                MsgBox "Bidang = " & cmbBidang.Text & " tidak terdaftar...", vbExclamation
                cmbBidang.SetFocus
                Exit Sub
            End If
            LblBidang = TNilai![Bidang Studi]
            TNilai.Close
            Set TNilai = Nothing
            DaftarPelajaran
            cmbBidang.Enabled = False
            CmbNIS.Enabled = True
            CmbNIS.SetFocus
            Me.MousePointer = 1
        End If
    End If
End Sub

Private Sub CmbBidang_KeyPress(KeyAscii As Integer)
KeyAscii = AutoComplete(cmbBidang, KeyAscii, True, Ubah)
End Sub

Private Sub cmbKelas_Click()
 If cmbKelas.Text <> "" Then
        Me.MousePointer = 11
        Kata = "Select * from kelas where [kode Kelas]='" & cmbKelas.Text & "'"
        Set TNilai = New ADODB.Recordset
            TNilai.Open Kata, Datasiswa, adOpenDynamic, adLockPessimistic
            If TNilai.EOF Then
                TNilai.Close
                Set TNilai = Nothing
                Me.MousePointer = 1
                MsgBox "Kelas = " & cmbKelas.Text & " tidak terdaftar...", vbExclamation
                cmbKelas.SetFocus
                Exit Sub
            End If
            LblKelas = TNilai![kelas]
            TNilai.Close
            Set TNilai = Nothing
            DaftarSiswa
            cmbKelas.Enabled = False
            CmbNIS.Enabled = True
            CmbNIS.SetFocus
            Me.MousePointer = 1
        End If
End Sub

Private Sub cmbKelas_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
    If cmbKelas.Text <> "" Then
        Me.MousePointer = 11
        Kata = "Select * from kelas where [kode Kelas]='" & cmbKelas.Text & "'"
        Set TNilai = New ADODB.Recordset
            TNilai.Open Kata, Datasiswa, adOpenDynamic, adLockPessimistic
            If TNilai.EOF Then
                TNilai.Close
                Set TNilai = Nothing
                Me.MousePointer = 1
                MsgBox "Kelas = " & cmbKelas.Text & " tidak terdaftar...", vbExclamation
                cmbKelas.SetFocus
                Exit Sub
            End If
            LblKelas = TNilai![kelas]
            TNilai.Close
            Set TNilai = Nothing
            DaftarSiswa
            cmbKelas.Enabled = False
            CmbNIS.Enabled = True
            CmbNIS.SetFocus
            Me.MousePointer = 1
        End If
    End If
End Sub

Private Sub CmbKelas_KeyPress(KeyAscii As Integer)
KeyAscii = AutoComplete(cmbKelas, KeyAscii, True, Ubah)
End Sub

Private Sub CmbNIS_Click()
 If CmbNIS.Text <> "" Then
        Me.MousePointer = 11
        Kata = "Select * from Siswa where [NIS]='" & CmbNIS.Text & "'"
        Set TNilai = New ADODB.Recordset
            TNilai.Open Kata, Datasiswa, adOpenDynamic, adLockPessimistic
            If TNilai.EOF Then
                TNilai.Close
                Set TNilai = Nothing
                Me.MousePointer = 1
                MsgBox "NIS = " & CmbNIS.Text & " tidak terdaftar...", vbExclamation
                CmbNIS.SetFocus
                Exit Sub
            End If
            LblPegawai = TNilai![Nama Siswa]
            TNilai.Close
            Set TNilai = Nothing
            DaftarBidang
            cmbBidang.Enabled = True
            cmbBidang.SetFocus
            Me.MousePointer = 1
        End If
End Sub

Private Sub CmbNIS_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
    If CmbNIS.Text <> "" Then
        Me.MousePointer = 11
        Kata = "Select * from Siswa where [NIS]='" & CmbNIS.Text & "'"
        Set TNilai = New ADODB.Recordset
            TNilai.Open Kata, Datasiswa, adOpenDynamic, adLockPessimistic
            If TNilai.EOF Then
                TNilai.Close
                Set TNilai = Nothing
                Me.MousePointer = 1
                MsgBox "NIS = " & CmbNIS.Text & " tidak terdaftar...", vbExclamation
                CmbNIS.SetFocus
                Exit Sub
            End If
            LblPegawai = TNilai![Nama Siswa]
            TNilai.Close
            Set TNilai = Nothing
            DaftarBidang
            cmbBidang.Enabled = True
            cmbBidang.SetFocus
            Me.MousePointer = 1
        End If
    End If
End Sub

Private Sub CmbPelajaran_Click()
If CmbPelajaran.Text <> "" Then
    For i = 1 To Lv1.ListItems.Count
                    If CmbPelajaran.Text = Lv1.ListItems(i).SubItems(5) Then
                        MsgBox "Kode Pelajaran Sudah Ada pada daftar....", vbExclamation, "Ooops..."
                        CmbPelajaran.SetFocus
                        Exit Sub
                    End If
                Next
        
                Me.MousePointer = 11
                Kata = "Select * from Pelajaran where [kode Pelajaran]='" & CmbPelajaran.Text & "'"
                Set TNilai = New ADODB.Recordset
                    TNilai.Open Kata, Datasiswa, adOpenDynamic, adLockPessimistic
                    If TNilai.EOF Then
                        TNilai.Close
                        Set TNilai = Nothing
                        Me.MousePointer = 1
                        MsgBox "Pelajaran = " & CmbPelajaran.Text & " tidak terdaftar...", vbExclamation
                        CmbPelajaran.SetFocus
                        Exit Sub
                    End If
                    LblPelajaran = TNilai![Pelajaran]
                    TNilai.Close
                    Set TNilai = Nothing
                    Fokus txtTugas
                   CmbNIS.Enabled = False
                    Me.MousePointer = 1
                    cmdHapus.Enabled = True
                    CmbPelajaran.SetFocus
                    Me.MousePointer = 1
            End If
    
End Sub

Private Sub CmbPelajaran_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
    If CmbPelajaran.Text <> "" Then
        Me.MousePointer = 11
        Kata = "Select * from Pelajaran where [kode Pelajaran]='" & CmbPelajaran.Text & "'"
        Set TNilai = New ADODB.Recordset
            TNilai.Open Kata, Datasiswa, adOpenDynamic, adLockPessimistic
            If TNilai.EOF Then
                TNilai.Close
                Set TNilai = Nothing
                Me.MousePointer = 1
                MsgBox "Pelajaran = " & CmbPelajaran.Text & " tidak terdaftar...", vbExclamation
                CmbPelajaran.SetFocus
                Exit Sub
            End If
            LblPelajaran = TNilai![Pelajaran]
            TNilai.Close
            Set TNilai = Nothing
           Fokus txtTugas
            Me.MousePointer = 1
        End If
    End If
End Sub

Private Sub cmbSemester_Click()
If cmbSemester.Text <> "" Then
        DaftarKelas
        cmbKelas.Enabled = True
        cmbKelas.SetFocus
        Exit Sub
    End If
End Sub

Private Sub cmbSemester_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
    If cmbSemester.Text <> "" Then
        DaftarKelas
        cmbKelas.Enabled = True
        cmbKelas.SetFocus
        Exit Sub
    End If
End If
End Sub

Private Sub cmbSemester_KeyPress(KeyAscii As Integer)
KeyAscii = AutoComplete(cmbSemester, KeyAscii, True, Ubah)
End Sub

Private Sub cmdEdit_Click()
Me.MousePointer = 11
vEdit = True
vTrans = True
Fokus txtTugas
cmdHapus.Enabled = False
cmdTambah.Caption = "&Batal"
cmdEdit.Enabled = False
Me.MousePointer = 1
End Sub

Private Sub cmdHapus_Click()
Dim i As Integer
Me.MousePointer = 11
'If txtNota <> "" Then
    Me.MousePointer = 1
    i = MsgBox("Anda Yakin untuk menghapus data ini...", vbInformation + vbOKCancel, "Security...")
    If i = vbOK Then
        Kata = MsgBox("Benar-benar yakin untuk menghapus Nilai Siswa= " & LblPegawai & " ini...", vbCritical + vbYesNo, "Informasi..")
        If Kata = vbYes Then
            Me.MousePointer = 11
            Penjualan.BeginTrans
            Penjualan.Execute "Delete Form Master Where [NIS]='" & CmbNIS.Text & "'"
            Penjualan.CommitTrans
            Semula
            Me.MousePointer = 1
        Exit Sub
        End If
    End If
'End If
Me.MousePointer = 1
End Sub

Private Sub cmdSimpan_Click()
Me.MousePointer = 11
If Not vEdit Then
    Simpan
Else
    Edit
End If
Semula
Me.MousePointer = 1
End Sub

Private Sub Form_Load()
Ketengah Me
End Sub

Private Sub Lv1_Click()
If Lv1.ListItems.Count <> 0 Then
CmbPelajaran = Lv1.SelectedItem.SubItems(5)
LblPelajaran = Lv1.SelectedItem.SubItems(6)
txtTugas = Lv1.SelectedItem.SubItems(7)
txtHuruf = Lv1.SelectedItem.SubItems(8)
txtCatatan = Lv1.SelectedItem.SubItems(9)
cmdEdit.SetFocus
End If
End Sub

Private Sub Lv1_ItemClick(ByVal Item As MSComctlLib.ListItem)
Lv1_Click
End Sub

Private Sub Text1_Change()
If Len(Text1.Text) = 4 Then
    Fokus Text2
    Text2.Text = Val(Text1.Text) + 1
    Exit Sub
End If
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)
If Not (KeyAscii >= Asc("0") & Chr(13) _
     And KeyAscii <= Asc("9") & Chr(13) _
     Or KeyAscii = vbKeyBack _
     Or KeyAscii = vbKeyDelete) Then
        Beep
        KeyAscii = 0
   End If
End Sub

Private Sub Text2_Change()
If Len(Text2.Text) = 4 Then
    If Text1.Text > Text2.Text Then
        MsgBox "Isikan Tahun Ajaran dengan benar....", vbInformation
        Fokus Text2
        Exit Sub
    End If
End If
End Sub



Sub Bersih()
Dim Control
For Each Control In Me.Controls
    If TypeOf Control Is TextBox Then
        Control.Text = ""
    End If
Next Control
End Sub

Sub Semula()
    cmdSimpan.Enabled = False
    cmdTambah.Caption = "&Tambah"
    Bersih
    vEdit = False
    vTrans = False
    NotAktif
    LblPegawai = "--"
    LblKelas = "--"
    Lv1.ListItems.Clear
End Sub

Sub NotAktif()
Dim Control
For Each Control In Me.Controls
    If TypeOf Control Is TextBox Then
        Control.Enabled = False
    End If
    If TypeOf Control Is ComboBox Then
        Control.Enabled = False
    End If
Next Control
End Sub



Private Sub cmdTambah_Click()
    Me.MousePointer = 11
    If cmdTambah.Caption = "&Tambah" Then
        cmdTambah.Caption = "&Batal"
       Fokus Text1
       Bersih
    Else
        Semula
    End If
    Me.MousePointer = 1
End Sub

Private Sub cmdTutup_Click()
Unload Me
End Sub

Sub DaftarGuru()
Me.MousePointer = 11
    Set TNilai = New ADODB.Recordset
        Kata = "Select * from Guru Order By [NIP]"
        TNilai.Open Kata, Datasiswa, adOpenDynamic, adLockPessimistic
        cmbNIP.Clear
        If Not TNilai.EOF Then
           TNilai.MoveFirst
           While Not TNilai.EOF
                cmbNIP.AddItem TNilai![NIP]
                TNilai.MoveNext
            Wend
        End If
        TNilai.Close
        Set TNilai = Nothing

    Me.MousePointer = 1

End Sub

Sub DaftarKelas()
Me.MousePointer = 11
    Set TNilai = New ADODB.Recordset
        Kata = "Select * from Kelas Order By [kode Kelas]"
        TNilai.Open Kata, Datasiswa, adOpenDynamic, adLockPessimistic
        cmbKelas.Clear
        If Not TNilai.EOF Then
           TNilai.MoveFirst
           While Not TNilai.EOF
                cmbKelas.AddItem TNilai![Kode kelas]
                TNilai.MoveNext
            Wend
        End If
        TNilai.Close
        Set TNilai = Nothing

    Me.MousePointer = 1

End Sub

Sub DaftarSiswa()
Me.MousePointer = 11
    Set TNilai = New ADODB.Recordset
        Kata = "Select * from QKelas where [Kode Kelas]='" & cmbKelas.Text & "' Order By [NIS]"
        TNilai.Open Kata, Datasiswa, adOpenDynamic, adLockPessimistic
        CmbNIS.Clear
        If Not TNilai.EOF Then
           TNilai.MoveFirst
           While Not TNilai.EOF
                CmbNIS.AddItem TNilai![NIS]
                TNilai.MoveNext
            Wend
        End If
        TNilai.Close
        Set TNilai = Nothing
    Me.MousePointer = 1

End Sub

Sub DaftarBidang()
Me.MousePointer = 11
    Set TNilai = New ADODB.Recordset
        Kata = "Select * from Bidang Order By [kode Bidang]"
        TNilai.Open Kata, Datasiswa, adOpenDynamic, adLockPessimistic
        cmbBidang.Clear
        If Not TNilai.EOF Then
           TNilai.MoveFirst
           While Not TNilai.EOF
                cmbBidang.AddItem TNilai![kode Bidang]
                TNilai.MoveNext
            Wend
        End If
        TNilai.Close
        Set TNilai = Nothing
    Me.MousePointer = 1

End Sub

Sub DaftarPelajaran()
Me.MousePointer = 11
    Set TNilai = New ADODB.Recordset
        Kata = "Select * from Pelajaran where [Kode Bidang]='" & cmbBidang.Text & "' Order By [Kode Pelajaran]"
        TNilai.Open Kata, Datasiswa, adOpenDynamic, adLockPessimistic
        CmbPelajaran.Clear
        If Not TNilai.EOF Then
           TNilai.MoveFirst
           While Not TNilai.EOF
                CmbPelajaran.AddItem TNilai![Kode Pelajaran]
                TNilai.MoveNext
            Wend
        End If
        TNilai.Close
        Set TNilai = Nothing
    Me.MousePointer = 1

End Sub

Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
    If Len(Text2.Text) = 4 Then
        If Text1.Text > Text2.Text Then
            MsgBox "Isikan Tahun Ajaran dengan benar....", vbInformation
            Fokus Text2
            Exit Sub
        End If
        cmbSemester.Enabled = True
        cmbSemester.SetFocus
    End If
End If
End Sub

Private Sub Text2_KeyPress(KeyAscii As Integer)
If Not (KeyAscii >= Asc("0") & Chr(13) _
     And KeyAscii <= Asc("9") & Chr(13) _
     Or KeyAscii = vbKeyBack _
     Or KeyAscii = vbKeyDelete) Then
        Beep
        KeyAscii = 0
   End If
End Sub


Private Sub txtAbsensi_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
    If txtAbsensi <> "" Then
        Fokus txtMID
        Exit Sub
    End If
End If
End Sub

Private Sub txtAbsensi_KeyPress(KeyAscii As Integer)
If Not (KeyAscii >= Asc("0") & Chr(13) _
     And KeyAscii <= Asc("9") & Chr(13) _
     Or KeyAscii = vbKeyBack _
     Or KeyAscii = vbKeyDelete) Then
        Beep
        KeyAscii = 0
   End If
End Sub

Private Sub txtMID_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
    If txtMID <> "" Then
        Fokus txtUAS
        Exit Sub
    End If
End If
End Sub

Private Sub txtMID_KeyPress(KeyAscii As Integer)
If Not (KeyAscii >= Asc("0") & Chr(13) _
     And KeyAscii <= Asc("9") & Chr(13) _
     Or KeyAscii = vbKeyBack _
     Or KeyAscii = vbKeyDelete) Then
        Beep
        KeyAscii = 0
   End If
End Sub


Private Sub txtCatatan_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
    If txtCatatan <> "" Then
        DaftarNilai
        Exit Sub
    End If
End If
End Sub

Private Sub txtTugas_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
    If txtTugas <> "" Then
        Fokus txtCatatan
        txtHuruf.Text = TerbilangDesimal(txtTugas)
        Exit Sub
    End If
End If
End Sub

Private Sub txtTugas_KeyPress(KeyAscii As Integer)
If Not (KeyAscii >= Asc("0") & Chr(13) _
     And KeyAscii <= Asc("9") & Chr(13) _
     Or KeyAscii = vbKeyBack _
     Or KeyAscii = vbKeyDelete) Then
        Beep
        KeyAscii = 0
   End If
End Sub

Sub DaftarNilai()
If Not vEdit Then
            Set Vbutir = Lv1.ListItems.Add(, , Lv1.ListItems.Count + 1 & ".")
                    Vbutir.SubItems(1) = CmbNIS
                    Vbutir.SubItems(2) = LblPegawai
                    Vbutir.SubItems(3) = cmbBidang
                    Vbutir.SubItems(4) = LblBidang
                    Vbutir.SubItems(5) = CmbPelajaran
                    Vbutir.SubItems(6) = LblPelajaran
                    Vbutir.SubItems(7) = txtTugas
                    Vbutir.SubItems(8) = txtHuruf
                    Vbutir.SubItems(9) = txtCatatan
                    Kata = MsgBox("Masih Ada Data Nilai Siswa Yang mau di Input....", vbExclamation + vbYesNo, "Informasi")
                    If Kata = vbYes Then
                        txtTugas = "": txtCatatan = ""
                        txtHuruf = ""
                         NotAktif
                        cmbBidang.Enabled = True
                        CmbPelajaran.Enabled = True
                        
                        Exit Sub
                    End If
                    cmdSimpan.Enabled = True
                    cmdSimpan.SetFocus
Else
    If Lv1.ListItems.Count > 0 Then
                    Lv1.ListItems.Remove Lv1.SelectedItem.Index
                For i = 1 To Lv1.ListItems.Count
                    Lv1.ListItems(i).Text = i & "."
                Next i
            End If
             Set Vbutir = Lv1.ListItems.Add(, , Lv1.ListItems.Count + 1 & ".")
                    Vbutir.SubItems(1) = CmbNIS
                    Vbutir.SubItems(2) = LblPegawai
                    Vbutir.SubItems(3) = cmbBidang
                    Vbutir.SubItems(4) = LblBidang
                    Vbutir.SubItems(5) = CmbPelajaran
                    Vbutir.SubItems(6) = LblPelajaran
                    Vbutir.SubItems(7) = txtTugas
                    Vbutir.SubItems(8) = txtHuruf
                    Vbutir.SubItems(9) = txtCatatan
                    cmdSimpan.Enabled = True
                    cmdSimpan.SetFocus
End If
End Sub

Sub Simpan()
Dim Tahun
Tahun = Text1.Text & "/" & Text2.Text
On Error GoTo Salah
    Datasiswa.BeginTrans
    For i = 1 To Lv1.ListItems.Count
        Datasiswa.Execute "Insert Into [Master Nilai] values ('" & Tahun & "','" & cmbSemester.Text & "'," & _
        "'" & LblKelas.Text & "','" & CmbNIS.Text & "','" & LblPegawai.Text & "','" & Lv1.ListItems(i).SubItems(4) & "'," & _
        "'" & Lv1.ListItems(i).SubItems(6) & "','" & Lv1.ListItems(i).SubItems(7) & "'," & _
        "'" & Lv1.ListItems(i).SubItems(8) & "','" & Lv1.ListItems(i).SubItems(9) & "')"
    Next i
    Datasiswa.CommitTrans
    Exit Sub
Salah:
MsgBox Err.Description

End Sub

Sub Edit()
On Error GoTo Salah
    Datasiswa.BeginTrans
    For i = 1 To Lv1.ListItems.Count
    Datasiswa.Execute "Update Master Set [Nilai Tugas]='" & Lv1.ListItems(i).SubItems(7) & "',Huruf='" & _
    Lv1.ListItems(i).SubItems(8) & "',[Catatan]='" & Lv1.ListItems(i).SubItems(9) & "' Where [Kode Pelajaran]='" & Lv1.ListItems(i).SubItems(5) & "'"
    Next i
    Datasiswa.CommitTrans
    Exit Sub
Salah:
    MsgBox Err.Description
End Sub

