Function CEK_JUR(X As String)
If XSMANLEE.Recordset.Fields("JURUSAN") = "IPA" Then
ket = "Ilmu Pengetahuan Alam "
ElseIf XSMANLEE.Recordset.Fields("JURUSAN") = "IPS" Then
ket = "Ilmu Pengetahuan Sosial "
ElseIf XSMANLEE.Recordset.Fields("JURUSAN") = "BAHASA" Then
ket = "Bahasa Indonesia "
ElseIf XSMANLEE.Recordset.Fields("JURUSAN") = "AGAMA" Then
ket = "Agama Islam "
End If
CEK_JUR = ket
End Function
If XSMANLEE.Recordset.Fields("JURUSAN") = "IPA" Then
ket = "Ilmu Pengetahuan Alam "
ElseIf XSMANLEE.Recordset.Fields("JURUSAN") = "IPS" Then
ket = "Ilmu Pengetahuan Sosial "
ElseIf XSMANLEE.Recordset.Fields("JURUSAN") = "BAHASA" Then
ket = "Bahasa Indonesia "
ElseIf XSMANLEE.Recordset.Fields("JURUSAN") = "AGAMA" Then
ket = "Agama Islam "
End If
CEK_JUR = ket
End Function
Private Sub
CboJurusan_Click()
If CboJurusan.Text = "IPA" Then
LblJurusan.Caption
= "Ilmu Pengetahuan Alam "
ElseIf CboJurusan.Text = "IPS" Then
LblJurusan.Caption
= "Ilmu Pengetahuan Sosial "
ElseIf CboJurusan.Text = "BAHASA" Then
LblJurusan.Caption
= "Bahasa Indonesia "
ElseIf CboJurusan.Text = "AGAMA" Then
LblJurusan.Caption
= "Agama Islam "
End If
End Sub
Private Sub
TxtNIS_KeyPress(KeyAscii As Integer)
'JIKA TOMBOL ENTER DITEKAN
If KeyAscii = 13
Then
'BUAT SQL
SQL =
"SELECT * FROM SISWA WHERE NIS ='" & TxtNIS.Text &
"'"
XSMANLEE.RecordSource = SQL
XSMANLEE.Refresh
'CEK RECORD
SUDAH ADA
If
XSMANLEE.Recordset.RecordCount > 0 Then
pil =
MsgBox("Data Sudah Ada...", vbYesNo + vbQuestion,
"KONFIRMASI")
If pil =
vbNo Then
Exit Sub
TxtNIS.SetFocus
End If
'TOMBOL-TOMBOL
CmdEdit.Enabled = True
CmdHapus.Enabled = True
CmdSimpan.Enabled
= False
'TAMPILKAN
DATA
TxtNama.Text
= XSMANLEE.Recordset.Fields("NAMA")
If
XSMANLEE.Recordset.Fields("JNS_KEL") = "L" Then
OptLakiLaki.Value = True
Else
OptPerempuan.Value = True
End If
CboJurusan.Text = XSMANLEE.Recordset.Fields("JURUSAN")
LblJurusan.Caption =
CEK_JUR(XSMANLEE.Recordset.Fields("JURUSAN"))
Else
TxtNama.SetFocus
'TOMBOL-TOMBOL
CmdEdit.Enabled = False
CmdHapus.Enabled = False
CmdSimpan.Enabled = True
TxtNama.Text
= ""
OptLakiLaki.Value = False
OptPerempuan.Value = False
CboJurusan.Text = ""
LblJurusan.Caption = ""
End If
End If
End Sub
Private Sub
CmdSimpan_Click()
'TOMBOL SIMPAN
XSMANLEE.Recordset.AddNew
XSMANLEE.Recordset.Fields("NIS") = TxtNIS.Text
XSMANLEE.Recordset.Fields("NAMA") = TxtNama.Text
If OptLakiLaki.Value
= True Then
XSMANLEE.Recordset.Fields("JNS_KEL") = "L"
End If
If
OptPerempuan.Value = True Then
XSMANLEE.Recordset.Fields("JNS_KEL") = "P"
End If
If
CboJurusan.ListIndex = 0 Then
XSMANLEE.Recordset.Fields("JURUSAN") = "IPA"
ElseIf CboJurusan.ListIndex
= 1 Then
XSMANLEE.Recordset.Fields("JURUSAN") = "IPS"
ElseIf
CboJurusan.ListIndex = 2 Then
XSMANLEE.Recordset.Fields("JURUSAN") = "BAHASA"
ElseIf
CboJurusan.ListIndex = 3 Then
XSMANLEE.Recordset.Fields("JURUSAN") = "AGAMA"
End If
XSMANLEE.Recordset.Update
XSMANLEE.Refresh
'XSMANLEE.Recordset.Index = "NIS"
TxtNIS.Text =
""
TxtNama.Text =
""
OptLakiLaki.Value =
False
OptPerempuan.Value =
False
CboJurusan.Text =
""
LblJurusan.Caption =
""
TxtNIS.SetFocus
End Sub
Tidak ada komentar:
Posting Komentar