VERSION 5.00
Begin VB.Form Form2 
   BorderStyle     =   4  'Fixed ToolWindow
   Caption         =   "Sistem Informasi Kriminalitas (File Pasal)"
   ClientHeight    =   2550
   ClientLeft      =   45
   ClientTop       =   285
   ClientWidth     =   3840
   LinkTopic       =   "Form2"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   2550
   ScaleWidth      =   3840
   ShowInTaskbar   =   0   'False
   Begin VB.Frame Frame3 
      BackColor       =   &H80000016&
      Height          =   1065
      Left            =   0
      TabIndex        =   7
      Top             =   1470
      Width           =   3855
      Begin VB.CommandButton command4 
         Caption         =   "&Cancel"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   855
         Left            =   2310
         Picture         =   "Form2.frx":0000
         Style           =   1  'Graphical
         TabIndex        =   12
         Top             =   150
         Width           =   735
      End
      Begin VB.CommandButton command2 
         Caption         =   "&Update"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   855
         Left            =   810
         Picture         =   "Form2.frx":0442
         Style           =   1  'Graphical
         TabIndex        =   11
         Top             =   150
         Width           =   735
      End
      Begin VB.CommandButton command1 
         Caption         =   "&Save"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   855
         Left            =   60
         Picture         =   "Form2.frx":0884
         Style           =   1  'Graphical
         TabIndex        =   10
         Top             =   150
         Width           =   735
      End
      Begin VB.CommandButton command3 
         Caption         =   "&Delete"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   855
         Left            =   1560
         Picture         =   "Form2.frx":0B8E
         Style           =   1  'Graphical
         TabIndex        =   9
         Top             =   150
         Width           =   735
      End
      Begin VB.CommandButton command5 
         Caption         =   "E&xit"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   855
         Left            =   3060
         Picture         =   "Form2.frx":0E98
         Style           =   1  'Graphical
         TabIndex        =   8
         Top             =   150
         Width           =   735
      End
   End
   Begin VB.Frame Frame1 
      BackColor       =   &H80000016&
      Height          =   1455
      Left            =   0
      TabIndex        =   3
      Top             =   0
      Width           =   3855
      Begin VB.TextBox Text1 
         Appearance      =   0  'Flat
         BackColor       =   &H00FFC0FF&
         BeginProperty Font 
            Name            =   "Times New Roman"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00004040&
         Height          =   375
         Left            =   1680
         MaxLength       =   5
         TabIndex        =   0
         Top             =   210
         Width           =   825
      End
      Begin VB.TextBox Text2 
         Appearance      =   0  'Flat
         BackColor       =   &H00FFC0C0&
         BeginProperty Font 
            Name            =   "Times New Roman"
            Size            =   9.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H80000012&
         Height          =   375
         Left            =   1680
         TabIndex        =   1
         Top             =   600
         Width           =   2115
      End
      Begin VB.TextBox Text3 
         Appearance      =   0  'Flat
         BackColor       =   &H00FFC0C0&
         BeginProperty Font 
            Name            =   "Times New Roman"
            Size            =   9.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H80000012&
         Height          =   375
         Left            =   1680
         TabIndex        =   2
         Top             =   990
         Width           =   2055
      End
      Begin VB.Label Label12 
         Appearance      =   0  'Flat
         BackColor       =   &H80000016&
         BorderStyle     =   1  'Fixed Single
         Caption         =   "Tindak Pidana"
         BeginProperty Font 
            Name            =   "Times New Roman"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H80000008&
         Height          =   375
         Left            =   390
         TabIndex        =   6
         Top             =   600
         Width           =   1275
      End
      Begin VB.Label Label9 
         Appearance      =   0  'Flat
         BackColor       =   &H80000016&
         BorderStyle     =   1  'Fixed Single
         Caption         =   "Nomor Pasal"
         BeginProperty Font 
            Name            =   "Times New Roman"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H80000008&
         Height          =   375
         Left            =   270
         TabIndex        =   5
         Top             =   210
         Width           =   1395
      End
      Begin VB.Label Label2 
         Appearance      =   0  'Flat
         BackColor       =   &H80000016&
         BorderStyle     =   1  'Fixed Single
         Caption         =   "Keterangan"
         BeginProperty Font 
            Name            =   "Times New Roman"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H80000008&
         Height          =   375
         Left            =   510
         TabIndex        =   4
         Top             =   990
         Width           =   1155
      End
   End
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rec As Recordset
Const putih = &HFFC0FF
Const abu = &HFFC0C0
Dim boleh As Boolean

Private Sub Form_Load()
tombol False, False, False
aktif False
End Sub

Private Sub tombol(a As Boolean, b As Boolean, c As Boolean)
  Command1.Enabled = a
  Command2.Enabled = b
  Command3.Enabled = c
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
 If Trim(Text1.Text) = "" Then
    MsgBox "Isi Data Dulu"
Else
 Set recp = db.OpenRecordset("select * from tpasal  where no_pas='" & Text1.Text & "'")
 If recp.EOF Then
  aktif True
  tombol True, False, False
  Text2.SetFocus
 Else
  cari
 End If
Set recp = Nothing
End If
End If
End Sub

Private Sub cari()
 Text2.Text = recp(1)
 Text3.Text = recp(2)
 If MsgBox("Data Sudah Ada..........,Update Data??", vbQuestion + vbYesNo, "Redundandy Input") = vbYes Then
  tombol False, True, False
 Else
  tombol False, False, True
 End If
End Sub

Private Sub kosong()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text1.SetFocus
End Sub

Private Sub aktif(p As Boolean)
Text2.Enabled = p
Text3.Enabled = p
If p = False Then
  warna = abu
Else
  warna = putih
End If
Text2.BackColor = warna
Text3.BackColor = warna
End Sub

Private Sub cek()
If Trim(Text2.Text) = "" Or Trim(Text3.Text) = "" Then
  boleh = False
Else
  boleh = True
End If
End Sub

Private Sub Command1_Click()
cek
If boleh Then
 If MsgBox("Simpan Data?????", vbYesNo + vbQuestion, "Replace") = vbYes Then
  db.Execute ("insert into tpasal values ('" & Text1.Text & "','" & Text2.Text & "','" & Text3.Text & "')")
  Command4_Click
 End If
Else
  MsgBox "isi dulu", vbInformation + vbOKOnly, "informasi"
  Text1.SetFocus
End If
End Sub

Private Sub Command2_Click()
cek
If boleh Then
 If MsgBox("Perbaharui Data?????", vbYesNo + vbQuestion, "Update") = vbYes Then
  db.Execute ("update tpasal set td_pidana= '" & Text2.Text & "',ket='" & Text3.Text & "' where no_pas='" & Text1.Text & "'")
  Command4_Click
 End If
Else
  MsgBox "isi dulu", vbInformation + vbOKOnly, "informasi"
  Text1.SetFocus
End If
End Sub

Private Sub Command3_Click()
If MsgBox("Hapus Data?????", vbYesNo + vbQuestion, "Delete") = vbYes Then
 db.Execute ("delete * from tpasal where no_pas ='" & Text1.Text & "'")
 Command4_Click
End If
End Sub

Private Sub Command4_Click()
kosong
tombol False, False, False
aktif False
End Sub

Private Sub Command5_Click()
Unload Me
End Sub


