VERSION 5.00
Begin VB.Form EditPelanggan 
   BackColor       =   &H00C0E0FF&
   Caption         =   "Edit Pelanggan"
   ClientHeight    =   3795
   ClientLeft      =   165
   ClientTop       =   555
   ClientWidth     =   6195
   LinkTopic       =   "Form1"
   MDIChild        =   -1  'True
   ScaleHeight     =   3795
   ScaleWidth      =   6195
   WindowState     =   2  'Maximized
   Begin VB.CommandButton cmdFirst 
      Appearance      =   0  'Flat
      BackColor       =   &H00C0FFFF&
      Caption         =   "|<"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   1320
      Style           =   1  'Graphical
      TabIndex        =   8
      Top             =   2160
      Width           =   735
   End
   Begin VB.CommandButton cmdPrevious 
      Appearance      =   0  'Flat
      BackColor       =   &H00C0FFFF&
      Caption         =   "<"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   2160
      Style           =   1  'Graphical
      TabIndex        =   7
      Top             =   2160
      Width           =   735
   End
   Begin VB.CommandButton cmdNext 
      Appearance      =   0  'Flat
      BackColor       =   &H00C0FFFF&
      Caption         =   ">"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   3000
      Style           =   1  'Graphical
      TabIndex        =   6
      Top             =   2160
      Width           =   735
   End
   Begin VB.CommandButton cmdLast 
      Appearance      =   0  'Flat
      BackColor       =   &H00C0FFFF&
      Caption         =   ">|"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   3840
      Style           =   1  'Graphical
      TabIndex        =   5
      Top             =   2160
      Width           =   735
   End
   Begin VB.TextBox txtKodePelanggan 
      Appearance      =   0  'Flat
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   285
      Left            =   2160
      TabIndex        =   4
      Top             =   360
      Width           =   2055
   End
   Begin VB.TextBox txtNamaPelanggan 
      Appearance      =   0  'Flat
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   285
      Left            =   2160
      TabIndex        =   3
      Top             =   720
      Width           =   3255
   End
   Begin VB.TextBox txtAlamatPelanggan 
      Appearance      =   0  'Flat
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   285
      Left            =   2160
      TabIndex        =   2
      Top             =   1080
      Width           =   3255
   End
   Begin VB.TextBox txtTeleponPelanggan 
      Appearance      =   0  'Flat
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   285
      Left            =   2160
      TabIndex        =   1
      Top             =   1440
      Width           =   2055
   End
   Begin VB.CommandButton cmdEdit 
      Appearance      =   0  'Flat
      BackColor       =   &H00C0FFC0&
      Caption         =   "&Edit"
      Enabled         =   0   'False
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   615
      Left            =   1800
      Style           =   1  'Graphical
      TabIndex        =   0
      Top             =   2880
      Width           =   2175
   End
   Begin VB.Frame Frame1 
      BackColor       =   &H00C0E0FF&
      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            =   960
      TabIndex        =   9
      Top             =   1920
      Width           =   4095
   End
   Begin VB.Label Label1 
      BackColor       =   &H00C0E0FF&
      Caption         =   "Kode Pelanggan"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   360
      TabIndex        =   13
      Top             =   360
      Width           =   1455
   End
   Begin VB.Label Label2 
      BackColor       =   &H00C0E0FF&
      Caption         =   "Nama Pelanggan"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   360
      TabIndex        =   12
      Top             =   720
      Width           =   1455
   End
   Begin VB.Label Label3 
      BackColor       =   &H00C0E0FF&
      Caption         =   "Alamat Pelangggan"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   360
      TabIndex        =   11
      Top             =   1080
      Width           =   1815
   End
   Begin VB.Label Label4 
      BackColor       =   &H00C0E0FF&
      Caption         =   "Telepon Pelanggan"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   360
      TabIndex        =   10
      Top             =   1440
      Width           =   1815
   End
   Begin VB.Menu mnu_keluar 
      Caption         =   "Keluar"
   End
End
Attribute VB_Name = "EditPelanggan"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim conAVB As ADODB.Connection
Dim rsPelanggan As ADODB.Recordset

Private Sub cmdEdit_Click()
  On Error GoTo HandleErrors
  With rsPelanggan
    ![Kode Pelanggan] = txtKodePelanggan.Text
    ![Nama Pelanggan] = txtNamaPelanggan.Text
    ![Alamat Pelanggan] = txtAlamatPelanggan.Text
    ![Telepon Pelanggan] = txtTeleponPelanggan.Text
    .Update
  End With
cmdEdit_Click_Exit:
  Exit Sub

HandleErrors:
  Dim strMessage As String
  Dim errDBError As ADODB.Error
  For Each errDBError In conAVB.Errors
    strMessage = strMessage & errDBError.Description & vbCrLf
  Next
  MsgBox strMessage, vbExclamation, " Data Kembar"
  On Error GoTo 0
End Sub

Private Sub cmdFirst_Click()
  On Error Resume Next
  rsPelanggan.MoveFirst
  TampilkanData
End Sub

Private Sub cmdLast_Click()
  On Error Resume Next
  rsPelanggan.MoveLast
  TampilkanData
End Sub

Private Sub cmdNext_Click()
  On Error Resume Next
  With rsPelanggan
    .MoveNext
    If .EOF Then
       .MoveLast
    End If
    TampilkanData
  End With
End Sub

Private Sub cmdPrevious_Click()
    On Error Resume Next
   With rsPelanggan
      .MovePrevious
      If .BOF Then
         .MoveFirst
      End If
      TampilkanData
  End With
End Sub

Private Sub Form_Load()
  Dim strSQL As String
  Set conAVB = New ADODB.Connection
    conAVB.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    "Persist Security info=False;Data source =" & App.Path & _
    "\AVB.mdb;mode = readwrite"
    conAVB.Open
  Set rsPelanggan = New ADODB.Recordset
  strSQL = "SELECT * FROM Pelanggan"
    rsPelanggan.Open strSQL, conAVB, adOpenDynamic, adLockOptimistic, adCmdText
End Sub

Private Sub mnu_keluar_Click()
  Unload Me
End Sub

Private Sub txtAlamatPelanggan_KeyPress(KeyAscii As Integer)
    KeyAscii = Asc(UCase(Chr(KeyAscii)))
End Sub

Private Sub txtNamaPelanggan_Change()
  cmdEdit.Enabled = True
End Sub

Private Sub TampilkanData()
  With rsPelanggan
    txtKodePelanggan.Text = ![Kode Pelanggan]
    txtNamaPelanggan.Text = ![Nama Pelanggan]
    txtAlamatPelanggan.Text = ![Alamat Pelanggan]
    txtTeleponPelanggan.Text = ![Telepon Pelanggan]
  End With
End Sub

Private Sub txtNamaPelanggan_KeyPress(KeyAscii As Integer)
    KeyAscii = Asc(UCase(Chr(KeyAscii)))
End Sub
