VERSION 5.00
Begin VB.Form Konsultan 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Entri Data Konsultan"
   ClientHeight    =   3585
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   4620
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   3585
   ScaleWidth      =   4620
   Begin VB.Data Data1 
      Caption         =   "Data1"
      Connect         =   "Access"
      DatabaseName    =   ""
      DefaultCursorType=   0  'DefaultCursor
      DefaultType     =   2  'UseODBC
      Exclusive       =   0   'False
      Height          =   375
      Left            =   5760
      Options         =   0
      ReadOnly        =   0   'False
      RecordsetType   =   1  'Dynaset
      RecordSource    =   ""
      Top             =   1440
      Width           =   1335
   End
   Begin VB.Frame Frame2 
      Height          =   615
      Left            =   240
      TabIndex        =   15
      Top             =   2760
      Width           =   4215
      Begin VB.CommandButton CMDKeluar 
         Caption         =   "&Keluar"
         Height          =   255
         Left            =   3120
         TabIndex        =   9
         Top             =   240
         Width           =   855
      End
      Begin VB.CommandButton CmdHapus 
         Caption         =   "&Hapus"
         Height          =   255
         Left            =   2160
         TabIndex        =   8
         Top             =   240
         Width           =   855
      End
      Begin VB.CommandButton Cmdedit 
         Caption         =   "&Edit"
         Height          =   255
         Left            =   1200
         TabIndex        =   7
         Top             =   240
         Width           =   855
      End
      Begin VB.CommandButton CMDSave 
         Caption         =   "&Save"
         Height          =   255
         Left            =   240
         TabIndex        =   6
         Top             =   240
         Width           =   855
      End
   End
   Begin VB.Frame Frame1 
      Height          =   2295
      Left            =   360
      TabIndex        =   0
      Top             =   240
      Width           =   3975
      Begin VB.ComboBox txttipe 
         Height          =   315
         ItemData        =   "Konsultan.frx":0000
         Left            =   1440
         List            =   "Konsultan.frx":000A
         TabIndex        =   5
         Top             =   1800
         Width           =   855
      End
      Begin VB.ComboBox txtjekel 
         Height          =   315
         ItemData        =   "Konsultan.frx":001E
         Left            =   1440
         List            =   "Konsultan.frx":0028
         TabIndex        =   4
         Top             =   1440
         Width           =   1095
      End
      Begin VB.TextBox txtalt 
         Height          =   285
         Left            =   1440
         TabIndex        =   3
         Top             =   1080
         Width           =   2055
      End
      Begin VB.TextBox txtnama 
         Height          =   285
         Left            =   1440
         TabIndex        =   2
         Top             =   720
         Width           =   1575
      End
      Begin VB.TextBox txtkode 
         Height          =   285
         Left            =   1440
         TabIndex        =   1
         Top             =   360
         Width           =   495
      End
      Begin VB.Label Label5 
         Caption         =   "Tipe"
         Height          =   255
         Left            =   240
         TabIndex        =   14
         Top             =   1800
         Width           =   855
      End
      Begin VB.Label Label4 
         Caption         =   "Jenis Kelamin"
         Height          =   255
         Left            =   240
         TabIndex        =   13
         Top             =   1440
         Width           =   975
      End
      Begin VB.Label Label3 
         Caption         =   "Alamat"
         Height          =   255
         Left            =   240
         TabIndex        =   12
         Top             =   1080
         Width           =   855
      End
      Begin VB.Label Label2 
         Caption         =   "Nama"
         Height          =   255
         Left            =   240
         TabIndex        =   11
         Top             =   720
         Width           =   855
      End
      Begin VB.Label Label1 
         Caption         =   "Kode"
         Height          =   255
         Left            =   240
         TabIndex        =   10
         Top             =   360
         Width           =   855
      End
   End
End
Attribute VB_Name = "Konsultan"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public dbasuransi As Database
Public rsKonsultan As Recordset
Private Sub Cmdedit_Click()
 rsKonsultan.Edit
 rsKonsultan(0) = txtkode.Text
 rsKonsultan(1) = txtnama.Text
 rsKonsultan(2) = txtalt.Text
 rsKonsultan(3) = txtjekel.Text
 rsKonsultan(4) = txttipe.Text
 rsKonsultan.Update
  Call bersih
End Sub
Private Sub Cmdhapus_Click()
rsKonsultan.Delete
Call bersih
End Sub
Private Sub Cmdkeluar_Click()
Unload Me
End Sub
Private Sub cmdsave_Click()
 rsKonsultan.AddNew
 rsKonsultan(0) = txtkode.Text
 rsKonsultan(1) = txtnama.Text
 rsKonsultan(2) = txtalt.Text
 rsKonsultan(3) = txtjekel.Text
 rsKonsultan(4) = txttipe.Text
 rsKonsultan.Update
 Call bersih
 End Sub
Private Sub bersih()
txtkode.Text = ""
txtnama.Text = ""
txtalt.Text = ""
txtjekel.Text = ""
txttipe.Text = ""
txtkode.SetFocus
End Sub
Private Sub Form_Load()
Set dbasuransi = OpenDatabase(App.Path & "\asuransi.mdb")
Set rsKonsultan = dbasuransi.OpenRecordset("konsultan")
rsKonsultan.Index = "cari"
End Sub

Private Sub txtkode_Change()
rsKonsultan.Seek "=", txtkode.Text
If rsKonsultan.NoMatch Then
cmdsave.Enabled = True
cmdhapus.Enabled = False
cmdedit.Enabled = False
ElseIf Not rsKonsultan.NoMatch Then
txtnama.Text = rsKonsultan(1)
txtalt.Text = rsKonsultan(2)
txtjekel.Text = rsKonsultan(3)
txttipe.Text = rsKonsultan(4)
cmdsave.Enabled = False
cmdhapus.Enabled = True
cmdedit.Enabled = True
End If
End Sub

