VERSION 5.00
Begin VB.Form Form1 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Jumlah Mengajar Guru .."
   ClientHeight    =   2985
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   2985
   ScaleWidth      =   4680
   Begin VB.TextBox txtStandar 
      Enabled         =   0   'False
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   285
      Left            =   3840
      TabIndex        =   21
      Top             =   1200
      Width           =   735
   End
   Begin VB.TextBox txtJlhKelas 
      Enabled         =   0   'False
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   285
      Left            =   1200
      TabIndex        =   10
      Top             =   480
      Width           =   735
   End
   Begin VB.TextBox txtJlhJam 
      Enabled         =   0   'False
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   285
      Left            =   3720
      TabIndex        =   9
      Top             =   480
      Width           =   735
   End
   Begin VB.TextBox txtJlhGuru 
      Enabled         =   0   'False
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   285
      Left            =   1200
      TabIndex        =   8
      Top             =   1200
      Width           =   735
   End
   Begin VB.ComboBox cmbBidang 
      Enabled         =   0   'False
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   315
      Left            =   1200
      TabIndex        =   7
      Top             =   840
      Width           =   3375
   End
   Begin VB.TextBox Text2 
      Enabled         =   0   'False
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   285
      Left            =   2040
      MaxLength       =   4
      TabIndex        =   6
      Top             =   120
      Width           =   495
   End
   Begin VB.TextBox Text1 
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   285
      Left            =   1200
      MaxLength       =   4
      TabIndex        =   5
      Top             =   120
      Width           =   495
   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            =   2520
      TabIndex        =   4
      Top             =   2520
      Width           =   945
   End
   Begin VB.CommandButton cmdTutup 
      BackColor       =   &H00D8E9EC&
      Caption         =   "&Tutup"
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   405
      Left            =   3600
      TabIndex        =   3
      Top             =   2520
      Width           =   945
   End
   Begin VB.TextBox txtJumlah 
      Enabled         =   0   'False
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   285
      Left            =   1200
      Locked          =   -1  'True
      TabIndex        =   2
      Top             =   1560
      Width           =   735
   End
   Begin VB.TextBox txtHasil 
      Enabled         =   0   'False
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   285
      Left            =   2760
      Locked          =   -1  'True
      TabIndex        =   1
      Top             =   1560
      Width           =   735
   End
   Begin VB.TextBox txtKet 
      Enabled         =   0   'False
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   285
      Left            =   1200
      TabIndex        =   0
      Top             =   1920
      Width           =   3375
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "Standar Jam Mengajar"
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   195
      Index           =   8
      Left            =   2040
      TabIndex        =   20
      Top             =   1200
      Width           =   1620
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "Jlh Kelas:"
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   195
      Index           =   0
      Left            =   120
      TabIndex        =   19
      Top             =   480
      Width           =   675
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "Jlh Jam:"
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   195
      Index           =   1
      Left            =   3000
      TabIndex        =   18
      Top             =   480
      Width           =   585
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "B. Studi"
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   195
      Index           =   2
      Left            =   120
      TabIndex        =   17
      Top             =   840
      Width           =   555
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "Jlh Guru:"
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   195
      Index           =   3
      Left            =   120
      TabIndex        =   16
      Top             =   1200
      Width           =   645
   End
   Begin VB.Label Label4 
      Alignment       =   2  'Center
      AutoSize        =   -1  'True
      Caption         =   "/"
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   285
      Left            =   1800
      TabIndex        =   15
      Top             =   120
      Width           =   105
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "Tahun Ajaran:"
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   195
      Index           =   4
      Left            =   120
      TabIndex        =   14
      Top             =   120
      Width           =   1035
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "Jumlah:"
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   195
      Index           =   5
      Left            =   120
      TabIndex        =   13
      Top             =   1560
      Width           =   555
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "Hasil:"
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   195
      Index           =   6
      Left            =   2040
      TabIndex        =   12
      Top             =   1560
      Width           =   390
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "Keterangan:"
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   195
      Index           =   7
      Left            =   120
      TabIndex        =   11
      Top             =   1920
      Width           =   900
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Kelas As Byte
Dim Jam As Byte
Dim Guru As Byte
Dim Jumlah As Byte
Dim Hasil As Byte

Private Sub cmbBidang_Click()
    If cmbBidang.Text <> "" Then
        Me.MousePointer = 11
        Kata = "Select * from mengajar where [studi]='" & cmbBidang.Text & "' ANd [Tahun Ajaran]='" & Text1.Text & "/" & Text2.Text & "'"
        Set TGuru = New ADODB.Recordset
            TGuru.Open Kata, Datasiswa, adOpenDynamic, adLockPessimistic
            If TGuru.EOF Then
                TGuru.Close
                Set TGuru = Nothing
                Fokus txtJlhGuru
                Me.MousePointer = 1
                Exit Sub
            End If
            TGuru.Close
            Set TGuru = Nothing
            Me.MousePointer = 1
            MsgBox "Jumlah Mengajar guru bidang studi = " & cmbBidang.Text & " sudah disimpan...", vbInformation
            cmbBidang.SetFocus
        End If
    
End Sub

Private Sub cmbBidang_KeyPress(KeyAscii As Integer)
KeyAscii = AutoComplete(cmbBidang, KeyAscii, True, Ubah)
End Sub

Private Sub cmdSimpan_Click()
On Error GoTo salah
    Me.MousePointer = 11
    Datasiswa.BeginTrans
    
    Datasiswa.Execute "Insert Into mengajar values ('" & Text1.Text & "/" & Text2.Text & "'," & _
    "'" & txtJlhKelas.Text & "','" & txtJlhJam.Text & "','" & cmbBidang.Text & "'," & _
    "'" & txtJlhGuru.Text & "','" & txtStandar.Text & "','" & txtJumlah.Text & "'," & _
    "'" & txtHasil.Text & "','" & txtKet.Text & "')"
    Datasiswa.CommitTrans
    Semula
    Me.MousePointer = 1
    Exit Sub
salah:
    MsgBox "Data tidak bisa di simpan..! ada kesalahan pada entry data ....?", vbCritical
End Sub

Private Sub cmdTutup_Click()
Unload Me
End Sub

Private Sub Form_Activate()
Fokus Text1
End Sub

Private Sub Form_Load()
Ketengah Me
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
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
        Fokus txtJlhKelas
    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
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
    Bersih
    vEdit = False
    vTrans = False
    NotAktif
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 txtJlhGuru_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
    If txtJlhGuru <> "" Then
        Fokus txtStandar
        Exit Sub
    End If
End If
End Sub

Private Sub txtJlhGuru_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 txtJlhJam_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
    If txtJlhJam <> "" Then
        Daftar
        cmbBidang.Enabled = True
        cmbBidang.SetFocus
        Exit Sub
    End If
End If
End Sub

Private Sub txtJlhJam_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 txtJlhKelas_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
    If txtJlhKelas <> "" Then
       Fokus txtJlhJam
       Exit Sub
    End If
End If
End Sub

Private Sub txtJlhKelas_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 Daftar()
Me.MousePointer = 11
    Set TGuru = New ADODB.Recordset
        Kata = "Select * from bidang Order By [Kode bidang]"
        TGuru.Open Kata, Datasiswa, adOpenDynamic, adLockPessimistic
        cmbBidang.Clear
        If Not TGuru.EOF Then
           TGuru.MoveFirst
           While Not TGuru.EOF
                cmbBidang.AddItem TGuru![Bidang Studi]
                TGuru.MoveNext
            Wend
        End If
        TGuru.Close
        Set TGuru = Nothing

    Me.MousePointer = 1

End Sub


Private Sub txtStandar_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
    If txtStandar <> "" Then
        On Error Resume Next
        Jumlah = Val(Int(txtJlhKelas.Text)) * Val(Int(txtJlhJam.Text)) / Val(Int(txtJlhGuru.Text))
        txtJumlah.Text = Jumlah
        txtHasil.Text = txtJumlah / txtJlhGuru
        If Val(Int(txtHasil)) > Val(Int(txtStandar)) Then
            txtKet.Text = "membutuhkan guru.."
        Else
            txtKet.Text = "Kelebihan guru.."
        End If
        cmdSimpan.Enabled = True
        cmdSimpan.SetFocus
        Exit Sub
    End If
End If
End Sub
