VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form frmGuru 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Data Guru - [SMP Negeri 2] Medan.."
   ClientHeight    =   3915
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   7155
   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     =   3915
   ScaleWidth      =   7155
   Begin VB.TextBox txtMasa 
      Enabled         =   0   'False
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   9
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   315
      Left            =   3000
      MaxLength       =   2
      TabIndex        =   44
      Top             =   2520
      Width           =   495
   End
   Begin VB.TextBox txtBulan 
      Enabled         =   0   'False
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   9
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   315
      Left            =   4080
      MaxLength       =   2
      TabIndex        =   43
      Top             =   2520
      Width           =   495
   End
   Begin VB.TextBox txtJabatan 
      Enabled         =   0   'False
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   9
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   315
      Left            =   960
      TabIndex        =   42
      Top             =   1320
      Width           =   1455
   End
   Begin VB.TextBox txtGapok 
      Enabled         =   0   'False
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   9
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   315
      Left            =   960
      TabIndex        =   36
      Top             =   2520
      Width           =   1455
   End
   Begin VB.TextBox txtGol 
      Enabled         =   0   'False
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   9
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   315
      Left            =   960
      TabIndex        =   34
      Top             =   2040
      Width           =   1455
   End
   Begin VB.TextBox txtJurusan 
      Enabled         =   0   'False
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   9
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   315
      Left            =   960
      MaxLength       =   15
      TabIndex        =   28
      Top             =   1680
      Width           =   3615
   End
   Begin VB.ComboBox cmbIjazah 
      Enabled         =   0   'False
      Height          =   315
      ItemData        =   "frmGuru.frx":0000
      Left            =   5400
      List            =   "frmGuru.frx":0019
      TabIndex        =   26
      Top             =   1320
      Width           =   1455
   End
   Begin MSComCtl2.DTPicker DTTanggal 
      Height          =   315
      Left            =   5640
      TabIndex        =   21
      Top             =   480
      Width           =   1455
      _ExtentX        =   2566
      _ExtentY        =   556
      _Version        =   393216
      Enabled         =   0   'False
      CheckBox        =   -1  'True
      Format          =   58327041
      CurrentDate     =   39314
   End
   Begin VB.TextBox txtTempat 
      Enabled         =   0   'False
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   9
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   315
      Left            =   960
      TabIndex        =   20
      Top             =   480
      Width           =   4575
   End
   Begin VB.ComboBox cmbAgama 
      Enabled         =   0   'False
      Height          =   315
      ItemData        =   "frmGuru.frx":0042
      Left            =   5400
      List            =   "frmGuru.frx":0052
      TabIndex        =   18
      Top             =   960
      Width           =   1455
   End
   Begin VB.ComboBox cmbStatus 
      Enabled         =   0   'False
      Height          =   315
      ItemData        =   "frmGuru.frx":0074
      Left            =   3240
      List            =   "frmGuru.frx":0084
      TabIndex        =   16
      Top             =   960
      Width           =   1335
   End
   Begin VB.ComboBox cmbKelamin 
      Enabled         =   0   'False
      Height          =   315
      ItemData        =   "frmGuru.frx":00A7
      Left            =   960
      List            =   "frmGuru.frx":00B1
      TabIndex        =   14
      Top             =   960
      Width           =   1455
   End
   Begin VB.TextBox txtNama 
      Enabled         =   0   'False
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   9
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   315
      Left            =   3360
      MaxLength       =   25
      TabIndex        =   12
      Top             =   120
      Width           =   3735
   End
   Begin VB.TextBox txtNIP 
      Enabled         =   0   'False
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   9
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   315
      Left            =   960
      TabIndex        =   10
      Top             =   120
      Width           =   1455
   End
   Begin VB.CommandButton cmdHapus 
      BackColor       =   &H00D8E9EC&
      Caption         =   "&Hapus"
      Enabled         =   0   'False
      Height          =   405
      Left            =   4920
      TabIndex        =   5
      Top             =   3360
      Width           =   945
   End
   Begin VB.CommandButton cmdTutup 
      BackColor       =   &H00D8E9EC&
      Caption         =   "&Tutup"
      Height          =   405
      Left            =   5880
      TabIndex        =   4
      Top             =   3360
      Width           =   945
   End
   Begin VB.CommandButton cmdEdit 
      BackColor       =   &H00D8E9EC&
      Caption         =   "&Edit"
      Enabled         =   0   'False
      Height          =   405
      Left            =   3960
      TabIndex        =   3
      Top             =   3360
      Width           =   945
   End
   Begin VB.CommandButton cmdSimpan 
      BackColor       =   &H00D8E9EC&
      Caption         =   "&Simpan"
      Enabled         =   0   'False
      Height          =   405
      Left            =   3000
      TabIndex        =   2
      Top             =   3360
      Width           =   945
   End
   Begin VB.CommandButton cmdTambah 
      BackColor       =   &H00D8E9EC&
      Caption         =   "&Tambah"
      Height          =   405
      Left            =   2040
      TabIndex        =   1
      Top             =   3360
      Width           =   945
   End
   Begin VB.TextBox txtCari 
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   9
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   315
      Left            =   240
      TabIndex        =   0
      Top             =   3480
      Width           =   1455
   End
   Begin MSComCtl2.DTPicker DTGuru 
      Height          =   315
      Left            =   3240
      TabIndex        =   23
      Top             =   1320
      Width           =   1335
      _ExtentX        =   2355
      _ExtentY        =   556
      _Version        =   393216
      Enabled         =   0   'False
      Format          =   58327041
      CurrentDate     =   39314
   End
   Begin MSComCtl2.DTPicker DTSK 
      Height          =   315
      Left            =   5400
      TabIndex        =   29
      Top             =   1680
      Width           =   1455
      _ExtentX        =   2566
      _ExtentY        =   556
      _Version        =   393216
      Enabled         =   0   'False
      Format          =   58327041
      CurrentDate     =   39314
   End
   Begin MSComCtl2.DTPicker DTMT 
      Height          =   315
      Left            =   3240
      TabIndex        =   33
      Top             =   2040
      Width           =   1335
      _ExtentX        =   2355
      _ExtentY        =   556
      _Version        =   393216
      Enabled         =   0   'False
      Format          =   58327041
      CurrentDate     =   39314
   End
   Begin MSComCtl2.DTPicker DTMulai 
      Height          =   315
      Left            =   5400
      TabIndex        =   37
      Top             =   2040
      Width           =   1455
      _ExtentX        =   2566
      _ExtentY        =   556
      _Version        =   393216
      Enabled         =   0   'False
      Format          =   58327041
      CurrentDate     =   39314
   End
   Begin VB.Label Label12 
      AutoSize        =   -1  'True
      Caption         =   "Bulan:"
      Height          =   195
      Index           =   1
      Left            =   4680
      TabIndex        =   41
      Top             =   2520
      Width           =   450
   End
   Begin VB.Label Label12 
      AutoSize        =   -1  'True
      Caption         =   "Tahun:"
      Height          =   195
      Index           =   0
      Left            =   3540
      TabIndex        =   40
      Top             =   2520
      Width           =   510
   End
   Begin VB.Label Label8 
      AutoSize        =   -1  'True
      Caption         =   "Masa"
      Height          =   195
      Index           =   6
      Left            =   2520
      TabIndex        =   39
      Top             =   2520
      Width           =   375
   End
   Begin VB.Label Label8 
      AutoSize        =   -1  'True
      Caption         =   "Mulai Tgs"
      Height          =   195
      Index           =   5
      Left            =   4680
      TabIndex        =   38
      Top             =   2040
      Width           =   660
   End
   Begin VB.Label Label8 
      AutoSize        =   -1  'True
      Caption         =   "Gj. Pokok:"
      Height          =   195
      Index           =   4
      Left            =   120
      TabIndex        =   35
      Top             =   2520
      Width           =   735
   End
   Begin VB.Label Label10 
      AutoSize        =   -1  'True
      Caption         =   "TMT:"
      Height          =   195
      Index           =   1
      Left            =   2760
      TabIndex        =   32
      Top             =   2040
      Width           =   360
   End
   Begin VB.Label Label8 
      AutoSize        =   -1  'True
      Caption         =   "Golongan:"
      Height          =   195
      Index           =   3
      Left            =   120
      TabIndex        =   31
      Top             =   2040
      Width           =   735
   End
   Begin VB.Label Label11 
      AutoSize        =   -1  'True
      Caption         =   "Tgl SK:"
      Height          =   195
      Left            =   4845
      TabIndex        =   30
      Top             =   1680
      Width           =   495
   End
   Begin VB.Label Label8 
      AutoSize        =   -1  'True
      Caption         =   "Jurusan:"
      Height          =   195
      Index           =   2
      Left            =   225
      TabIndex        =   27
      Top             =   1680
      Width           =   630
   End
   Begin VB.Label Label8 
      AutoSize        =   -1  'True
      Caption         =   "Ijazah:"
      Height          =   195
      Index           =   1
      Left            =   4830
      TabIndex        =   25
      Top             =   1320
      Width           =   510
   End
   Begin VB.Label Label10 
      AutoSize        =   -1  'True
      Caption         =   "TMTGuru:"
      Height          =   195
      Index           =   0
      Left            =   2520
      TabIndex        =   24
      Top             =   1320
      Width           =   705
   End
   Begin VB.Label Label8 
      AutoSize        =   -1  'True
      Caption         =   "Jabatan:"
      Height          =   195
      Index           =   0
      Left            =   210
      TabIndex        =   22
      Top             =   1320
      Width           =   645
   End
   Begin VB.Label Label3 
      AutoSize        =   -1  'True
      Caption         =   "T. Lahir."
      Height          =   195
      Index           =   1
      Left            =   255
      TabIndex        =   19
      Top             =   480
      Width           =   600
   End
   Begin VB.Label Label7 
      AutoSize        =   -1  'True
      Caption         =   "Agama:"
      Height          =   195
      Left            =   4785
      TabIndex        =   17
      Top             =   960
      Width           =   555
   End
   Begin VB.Label Label6 
      AutoSize        =   -1  'True
      Caption         =   "Status:"
      Height          =   195
      Left            =   2700
      TabIndex        =   15
      Top             =   960
      Width           =   525
   End
   Begin VB.Label Label5 
      AutoSize        =   -1  'True
      Caption         =   "J. Kelamin"
      Height          =   195
      Left            =   135
      TabIndex        =   13
      Top             =   960
      Width           =   720
   End
   Begin VB.Label Label4 
      AutoSize        =   -1  'True
      Caption         =   "Nama Guru:"
      Height          =   195
      Left            =   2520
      TabIndex        =   11
      Top             =   120
      Width           =   855
   End
   Begin VB.Label Label3 
      AutoSize        =   -1  'True
      Caption         =   "NIP:"
      Height          =   195
      Index           =   0
      Left            =   540
      TabIndex        =   9
      Top             =   120
      Width           =   315
   End
   Begin VB.Line Line1 
      BorderColor     =   &H80000002&
      X1              =   120
      X2              =   1800
      Y1              =   3240
      Y2              =   3240
   End
   Begin VB.Line Line2 
      BorderColor     =   &H8000000D&
      X1              =   1920
      X2              =   6960
      Y1              =   3240
      Y2              =   3240
   End
   Begin VB.Shape Shape1 
      BorderColor     =   &H00FF8080&
      Height          =   855
      Index           =   0
      Left            =   120
      Top             =   3000
      Width           =   1695
   End
   Begin VB.Shape Shape1 
      BorderColor     =   &H00FF8080&
      Height          =   855
      Index           =   1
      Left            =   1920
      Top             =   3000
      Width           =   5055
   End
   Begin VB.Label Label2 
      Alignment       =   2  'Center
      BackColor       =   &H80000018&
      Caption         =   "P r o s e s"
      ForeColor       =   &H00004000&
      Height          =   255
      Index           =   2
      Left            =   1920
      TabIndex        =   8
      Top             =   3000
      Width           =   5055
   End
   Begin VB.Label Label2 
      Alignment       =   2  'Center
      BackColor       =   &H80000018&
      Caption         =   "C a r i"
      ForeColor       =   &H00004000&
      Height          =   255
      Index           =   0
      Left            =   120
      TabIndex        =   7
      Top             =   3000
      Width           =   1695
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "No Induk Pegawai:"
      Height          =   195
      Index           =   6
      Left            =   240
      TabIndex        =   6
      Top             =   3240
      Width           =   1350
   End
End
Attribute VB_Name = "frmGuru"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

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
    cmdEdit.Enabled = False
    cmdHapus.Enabled = False
    cmdTambah.Caption = "&Tambah"
    Bersih
    vEdit = False
    vTrans = False
    NotAktif
    txtCari.Enabled = True
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 cmbAgama_Click()
If cmbAgama.Text <> "" Then
        Fokus txtJabatan
        Exit Sub
    End If
End Sub

Private Sub cmbAgama_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
    If cmbAgama.Text <> "" Then
        Fokus txtJabatan
        Exit Sub
    End If
End If
End Sub

Private Sub cmbAgama_KeyPress(KeyAscii As Integer)
KeyAscii = AutoComplete(cmbAgama, KeyAscii, True, Ubah)
End Sub


Private Sub cmbIjazah_Click()
If cmbIjazah.Text <> "" Then
    Fokus txtJurusan
    Exit Sub
End If
End Sub

Private Sub cmbIjazah_KeyPress(KeyAscii As Integer)
KeyAscii = AutoComplete(cmbIjazah, KeyAscii, True, Ubah)
End Sub

Private Sub cmbKelamin_Click()
If cmbKelamin.Text <> "" Then
    cmbStatus.Enabled = True
    cmbStatus.SetFocus
End If
End Sub

Private Sub cmbKelamin_KeyDown(KeyCode As Integer, Shift As Integer)
If cmbKelamin.Text <> "" Then
    cmbStatus.Enabled = True
    cmbStatus.SetFocus
End If
    
End Sub

Private Sub cmbKelamin_KeyPress(KeyAscii As Integer)
KeyAscii = AutoComplete(cmbKelamin, KeyAscii, True, Ubah)
End Sub

Private Sub cmbStatus_Click()
If cmbStatus.Text <> "" Then
    cmbAgama.Enabled = True
    cmbAgama.SetFocus
End If
End Sub

Private Sub cmbStatus_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
If cmbStatus.Text <> "" Then
    cmbAgama.Enabled = True
    cmbAgama.SetFocus
End If
End If
End Sub

Private Sub cmbStatus_KeyPress(KeyAscii As Integer)
KeyAscii = AutoComplete(cmbKelamin, KeyAscii, True, Ubah)
End Sub

Private Sub cmdEdit_Click()
    Me.MousePointer = 11
    vEdit = True
    vTrans = True
    Fokus txtNama
    cmdEdit.Enabled = False
    cmdHapus.Enabled = False
    cmdTambah.Caption = "&Batal"
    cmdSimpan.Enabled = True
    Me.MousePointer = 1
End Sub

Private Sub cmdHapus_Click()
    Kata = MsgBox("Data Guru : " & txtNama & " : Mau dihapus...", vbInformation + vbYesNo, "Warning....")
    If Kata = vbYes Then
        Me.MousePointer = 11
        Datasiswa.Execute "Delete From Guru Where [NIP]='" & txtNIP.Text & "'"
        Semula
        Me.MousePointer = 1
        MsgBox "Data Guru sudah berhasil di hapus....", vbExclamation
    End If
End Sub



Private Sub cmdSimpan_Click()
Me.MousePointer = 1
   If Not vEdit Then
        Simpan
    Else
        Edit
    End If
Semula
Me.MousePointer = 1
End Sub

Private Sub cmdTambah_Click()
    Me.MousePointer = 11
    If cmdTambah.Caption = "&Tambah" Then
        cmdTambah.Caption = "&Batal"
       Fokus txtNIP
       Bersih
       txtCari.Enabled = False
    Else
        Semula
    End If
    Me.MousePointer = 1
End Sub

Private Sub cmdTutup_Click()
Unload Me
End Sub

Private Sub DTGuru_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
    cmbIjazah.Enabled = True
    cmbIjazah.SetFocus
End If
End Sub

Private Sub DTMT_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
    DTMulai.Enabled = True
    DTMulai.SetFocus
    Exit Sub
End If
    
End Sub

Private Sub DTMulai_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
    Fokus txtGapok
End If
End Sub

Private Sub DTSK_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
    Fokus txtGol
    Exit Sub
End If
End Sub

Private Sub DTTanggal_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = 13 Then
        cmbKelamin.Enabled = True
        cmbKelamin.SetFocus
        Exit Sub
    End If
        
End Sub


Private Sub Form_Activate()
    cmdTambah.SetFocus
End Sub

Private Sub Form_Load()
    Ketengah Me
End Sub

Private Sub Form_Unload(Cancel As Integer)
Dim Kata As String
    If Not vTrans Then
        cmdTutup_Click
    Else
        Kata = MsgBox("Data guru ini belum di simpan..." & vbCrLf & _
                    "Apakah data guru ini mau di simpan...", vbQuestion + vbYesNo, "Informasi")
        If Kata = vbYes Then
            cmdSimpan.Enabled = True
            cmdSimpan_Click
            Unload Me
        Else
        Unload Me
        End If
    End If
    
End Sub





Private Sub txtBulan_Change()
If Len(txtBulan) = 2 Then
    cmdSimpan.Enabled = True
    cmdSimpan.SetFocus
    Exit Sub
End If
End Sub

Private Sub txtCari_Change()
If Len(txtCari) = 9 Then
    Me.MousePointer = 11
    Kata = "Select * from Guru Where NIP='" & txtCari.Text & "'"
    Set TGuru = New ADODB.Recordset
        TGuru.Open Kata, Datasiswa, adOpenDynamic, adLockPessimistic
        If TGuru.EOF Then
            TGuru.Close
            Set TGuru = Nothing
            Me.MousePointer = 1
            MsgBox "NIP tidak ditemukan dalam Tabel guru...", vbInformation, "NIP Invalid.."
            Fokus txtCari
            Exit Sub
        End If
        DaftarGuru
        cmdHapus.Enabled = True
        cmdEdit.Enabled = True
        cmdTambah.Caption = "&Batal"
        TGuru.Close
        Set TGuru = Nothing
        Me.MousePointer = 1
End If
End Sub

Private Sub txtGol_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
    If txtGol <> "" Then
        DTMT.Enabled = True
        DTMT.SetFocus
        Exit Sub
    End If
End If
End Sub

Private Sub txtJabatan_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
    If txtJabatan <> "" Then
        DTGuru.Enabled = True
        DTGuru.SetFocus
        Exit Sub
    End If
End If
End Sub

Private Sub txtJurusan_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
    If txtJurusan <> "" Then
        DTSK.Enabled = True
        DTSK.SetFocus
        Exit Sub
    End If
End If
End Sub

Private Sub txtMasa_Change()
If Len(txtMasa) = 2 Then
    Fokus txtBulan
    Exit Sub
End If

End Sub

Private Sub txtNama_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = 13 Then
        If txtNama = "" Then
            MsgBox "Nama guru harus di isi....", vbExclamation
            Fokus txtNama
            Exit Sub
        End If
        Me.MousePointer = 11
        Fokus txtTempat
        Me.MousePointer = 1
    End If
End Sub

Private Sub txtNama_KeyPress(KeyAscii As Integer)
If Not (KeyAscii >= Asc("a") & Chr(13) _
     And KeyAscii <= Asc("z") & Chr(13) _
     Or (KeyAscii >= Asc("A") & Chr(13) _
     And KeyAscii <= Asc("Z") & Chr(13) _
     Or KeyAscii = vbKeyBack _
     Or KeyAscii = vbKeyDelete _
     Or KeyAscii = vbKeySpace)) Then
        Beep
        KeyAscii = 0
   End If
End Sub


Private Sub txtNIP_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
    If txtNIP <> "" Then
        If Len(txtNIP) <> 9 Then
            MsgBox "NIP harus di input sebanyak 9 digit..."
            Fokus txtNIP
            Exit Sub
        End If
        
        Me.MousePointer = 11
        Kata = "Select * from guru where NIP ='" & txtNIP.Text & "'"
        Set TGuru = New ADODB.Recordset
            TGuru.Open Kata, Datasiswa, adOpenDynamic, adLockPessimistic
            If TGuru.EOF Then
                TGuru.Close
                Set TGuru = Nothing
                Me.MousePointer = 1
                Fokus txtNama
                Exit Sub
            End If
            DaftarGuru
            cmdEdit.Enabled = True
            cmdHapus.Enabled = True
            cmdTambah.Caption = "&Batal"
            cmdEdit.Enabled = True
            Fokus txtNama
            TGuru.Close
            Set TGuru = Nothing
            Me.MousePointer = 1
    End If
End If
End Sub

Private Sub txtGapok_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
    If txtGapok <> "" Then
        txtGapok.Text = Format(txtGapok, "#,##0")
        Fokus txtMasa
        Exit Sub
    End If
End If
End Sub

Private Sub txtGapok_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 txtTempat_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        If txtTempat = "" Then
            MsgBox "Tempat Lahir harus di isi....", vbExclamation
            Fokus txtTempat
            Exit Sub
        End If
        DTTanggal.Enabled = True
        DTTanggal.SetFocus
    End If
End Sub

Sub Simpan()
    On Error GoTo Salah
    Datasiswa.BeginTrans
    
    Datasiswa.Execute "Insert Into guru Values ('" & txtNIP.Text & "','" & txtNama.Text & "'," & _
    "'" & txtTempat.Text & "','" & DTTanggal.Value & "','" & cmbKelamin.Text & "','" & cmbStatus.Text & "'," & _
    "'" & cmbAgama.Text & "','" & txtJabatan.Text & "','" & DTGuru.Value & "','" & cmbIjazah.Text & "'," & _
    "'" & txtJurusan.Text & "','" & DTSK.Value & "','" & txtGol.Text & "','" & DTMT.Value & "'," & _
    "'" & txtGapok.Text & "','" & DTMulai.Value & "','" & txtMasa.Text & "','" & txtBulan.Text & "')"
    
    Datasiswa.CommitTrans
    
    Exit Sub
Salah:
    MsgBox "Data guru tidak bisa di simpan..., Ada Kesalahan...!", vbInformation
End Sub

Sub Edit()
    On Error GoTo Salah
        
        Datasiswa.BeginTrans
                
       Datasiswa.Execute "Update Guru Set [nama Guru]='" & txtNama.Text & "',[Tempat Lahir]='" & _
       txtTempat.Text & "',[Tgl Lahir]='" & DTTanggal.Value & "',[JK]='" & _
       cmbKelamin.Text & "',[Status]='" & cmbStatus.Text & "',Agama='" & _
       cmbAgama.Text & "',Jabatan='" & txtJabatan.Text & "',[Tgl Guru]='" & DTGuru.Value & "',ijazah='" & _
       cmbIjazah.Text & "',Jurusan='" & txtJurusan.Text & "',[Tgl SK]='" & DTSK.Value & "',Gol='" & _
       txtGol.Text & "',TMT='" & DTMT.Value & "',Gapok='" & txtGapok.Text & "',[Masa Tahun]='" & _
       txtMasa.Text & "',[Masa bulan]='" & txtBulan.Text & "' Where NIP='" & txtNIP.Text & "'"
       
       Datasiswa.CommitTrans
       
       Exit Sub
Salah:
       MsgBox " Data guru tidak bisa di edit..., Ada data yang Salah...!", vbExclamation
       
End Sub

Sub DaftarGuru()
    Me.MousePointer = 11
    With TGuru
        txtNIP = !NIP
        txtNama = ![Nama Guru]
        txtTempat = ![Tempat Lahir]
        DTTanggal = ![Tgl lahir]
        cmbKelamin = ![JK]
        cmbStatus = !Status
        cmbAgama = !Agama
        txtJabatan = ![jabatan]
        DTGuru.Value = ![Tgl guru]
        cmbIjazah = !Ijazah
        txtJurusan = !jurusan
        DTSK = ![Tgl SK]
        txtGol = ![Gol]
        DTMT = ![TMT]
        txtGapok = ![Gapok]
        txtMasa = ![Masa Tahun]
        txtBulan = ![masa Bulan]
    End With
    
    Me.MousePointer = 1
        
End Sub
