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