VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form Siswa 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Siswa Baru"
   ClientHeight    =   4380
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   5085
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   4380
   ScaleWidth      =   5085
   Begin VB.Frame Frame1 
      Height          =   3435
      Left            =   240
      TabIndex        =   12
      Top             =   120
      Width           =   4575
      Begin VB.ComboBox daftar 
         Height          =   315
         Left            =   1740
         TabIndex        =   1
         Top             =   240
         Width           =   1035
      End
      Begin VB.TextBox nis 
         Height          =   315
         Left            =   1740
         MaxLength       =   5
         TabIndex        =   2
         Text            =   " "
         Top             =   600
         Width           =   855
      End
      Begin VB.TextBox nama 
         Height          =   315
         Left            =   1740
         MaxLength       =   25
         TabIndex        =   3
         Text            =   " "
         Top             =   960
         Width           =   2235
      End
      Begin VB.TextBox alamat 
         Height          =   315
         Left            =   1740
         MaxLength       =   30
         TabIndex        =   4
         Text            =   " "
         Top             =   1320
         Width           =   2655
      End
      Begin VB.TextBox tempat 
         Height          =   315
         Left            =   1740
         TabIndex        =   6
         Text            =   " "
         Top             =   2040
         Width           =   2235
      End
      Begin VB.TextBox wali 
         Height          =   315
         Left            =   1740
         TabIndex        =   8
         Text            =   " "
         Top             =   2760
         Width           =   2235
      End
      Begin VB.ComboBox Kelamin 
         Height          =   315
         ItemData        =   "Siswa.frx":0000
         Left            =   1740
         List            =   "Siswa.frx":000A
         TabIndex        =   5
         Top             =   1680
         Width           =   1575
      End
      Begin MSComCtl2.DTPicker tanggal 
         Height          =   315
         Left            =   1740
         TabIndex        =   7
         Top             =   2400
         Width           =   1275
         _ExtentX        =   2249
         _ExtentY        =   556
         _Version        =   393216
         CustomFormat    =   "dd/MM/yyyy"
         Format          =   24576003
         CurrentDate     =   37435
      End
      Begin VB.Label Label7 
         Caption         =   "NIS"
         Height          =   315
         Left            =   240
         TabIndex        =   21
         Top             =   660
         Width           =   1215
      End
      Begin VB.Label Label1 
         Caption         =   "No_ Pendaftaran"
         Height          =   315
         Left            =   240
         TabIndex        =   20
         Top             =   300
         Width           =   1395
      End
      Begin VB.Label Label2 
         Caption         =   "Nama"
         Height          =   315
         Left            =   240
         TabIndex        =   19
         Top             =   1020
         Width           =   1215
      End
      Begin VB.Label Label3 
         Caption         =   "Alamat"
         Height          =   315
         Left            =   240
         TabIndex        =   18
         Top             =   1380
         Width           =   1215
      End
      Begin VB.Label Label4 
         Caption         =   "Jenis Kelamin"
         Height          =   315
         Left            =   240
         TabIndex        =   17
         Top             =   1740
         Width           =   1215
      End
      Begin VB.Label Label5 
         Caption         =   "Tempat Lahir"
         Height          =   315
         Left            =   240
         TabIndex        =   16
         Top             =   2100
         Width           =   1215
      End
      Begin VB.Label Label6 
         Caption         =   "Tanggal Lahir"
         Height          =   315
         Left            =   240
         TabIndex        =   15
         Top             =   2460
         Width           =   1215
      End
      Begin VB.Label Label8 
         Caption         =   "Orang Tua/Wali"
         Height          =   315
         Left            =   240
         TabIndex        =   14
         Top             =   2820
         Width           =   1215
      End
   End
   Begin VB.Frame Frame2 
      Height          =   615
      Left            =   240
      TabIndex        =   0
      Top             =   3600
      Width           =   4575
      Begin VB.CommandButton simpan 
         Caption         =   "&Simpan"
         Height          =   495
         Left            =   120
         TabIndex        =   9
         Top             =   120
         Width           =   1095
      End
      Begin VB.CommandButton Koreksi 
         Caption         =   "&Koreksi"
         Height          =   495
         Left            =   1200
         TabIndex        =   10
         Top             =   120
         Width           =   1095
      End
      Begin VB.CommandButton Hapus 
         Caption         =   "&Hapus"
         Height          =   495
         Left            =   2280
         TabIndex        =   11
         Top             =   120
         Width           =   1095
      End
      Begin VB.CommandButton Keluar 
         Caption         =   "&Keluar"
         Height          =   495
         Left            =   3360
         TabIndex        =   13
         Top             =   120
         Width           =   1095
      End
   End
   Begin VB.Data Data1 
      Caption         =   "Data1"
      Connect         =   "Access"
      DatabaseName    =   ""
      DefaultCursorType=   0  'DefaultCursor
      DefaultType     =   2  'UseODBC
      Exclusive       =   0   'False
      Height          =   555
      Left            =   5460
      Options         =   0
      ReadOnly        =   0   'False
      RecordsetType   =   1  'Dynaset
      RecordSource    =   ""
      Top             =   2040
      Width           =   1140
   End
End
Attribute VB_Name = "Siswa"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public dbcalon As Database
Public rscalon As Recordset
Public dbsiswa As Database
Public rssiswa As Recordset

Private Sub daftar_Click()
rscalon.Seek "=", daftar.Text
If Not rscalon.NoMatch Then
 nis.Text = ""
 nama.Text = rscalon(1)
 alamat.Text = rscalon(2)
 Kelamin.Text = rscalon(3)
 tempat.Text = rscalon(4)
 tanggal.Value = rscalon(5)
 daftar.Enabled = False
 nama.Enabled = False
 alamat.Enabled = False
 Kelamin.Enabled = False
 tempat.Enabled = False
  tanggal.Enabled = False
 
 Else
 nis.Text = ""
 nama.Text = ""
 alamat.Text = ""
 Kelamin.Text = ""
 tempat.Text = ""
 'tanggal.Value = ""
End If
End Sub

Private Sub koreksi_Click()
 rssiswa.Edit
 rssiswa(0) = nis.Text
 rssiswa(1) = nama.Text
 rssiswa(2) = alamat.Text
 rssiswa(3) = Kelamin.Text
 rssiswa(4) = tempat.Text
 rssiswa(5) = tanggal.Value
 rssiswa(6) = wali.Text
   rssiswa.Update
  Call bersih
End Sub
Private Sub hapus_Click()
rssiswa.Delete
Call bersih
End Sub
Private Sub keluar_Click()
Unload Me
End Sub

Private Sub nis_Change()
    rssiswa.Seek "=", nis.Text
    If rssiswa.NoMatch Then
    wali = ""
    simpan.Enabled = True
    Hapus.Enabled = False
    Koreksi.Enabled = False
    ElseIf Not rssiswa.NoMatch Then
    nama.Text = rssiswa(1)
    alamat.Text = rssiswa(2)
    Kelamin.Text = rssiswa(3)
    tempat.Text = rssiswa(4)
    tanggal.Value = rssiswa(5)
    wali.Text = rssiswa(6)
    nama.Enabled = True
 Kelamin.Enabled = True
 alamat.Enabled = True
 tempat.Enabled = True
  tanggal.Enabled = True
    simpan.Enabled = False
    Hapus.Enabled = True
    Koreksi.Enabled = True
End If
End Sub

Private Sub simpan_Click()
 rssiswa.AddNew
rssiswa(0) = nis.Text
 rssiswa(1) = nama.Text
 rssiswa(2) = alamat.Text
 rssiswa(3) = Kelamin.Text
 rssiswa(4) = tempat.Text
 rssiswa(5) = tanggal.Value
 rssiswa(6) = wali.Text
  rssiswa.Update
  Call bersih
 End Sub
Private Sub bersih()
daftar.Text = ""
nis.Text = ""
nama.Text = ""
alamat.Text = ""
Kelamin.Text = ""
tempat.Text = ""
wali.Text = ""
daftar.Enabled = True
daftar.SetFocus
End Sub
Private Sub Form_Load()
Set dbcalon = OpenDatabase(App.Path & "\Siswa baru.mdb")
Set rscalon = dbcalon.OpenRecordset("calon")
rscalon.Index = "cari1"
Set dbsiswa = OpenDatabase(App.Path & "\Siswa baru.mdb")
Set rssiswa = dbsiswa.OpenRecordset("siswa")
rssiswa.Index = "cari"
rscalon.MoveFirst
While Not rscalon.EOF
daftar.AddItem (rscalon(0))
rscalon.MoveNext
Wend
End Sub







