VERSION 5.00
Begin VB.Form EditPemasok 
   BackColor       =   &H00C0E0FF&
   Caption         =   "Mencari Data Kode Pemasok"
   ClientHeight    =   3300
   ClientLeft      =   60
   ClientTop       =   750
   ClientWidth     =   7110
   LinkTopic       =   "Form1"
   MDIChild        =   -1  'True
   ScaleHeight     =   3300
   ScaleWidth      =   7110
   WindowState     =   2  'Maximized
   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          =   735
      Left            =   1920
      Style           =   1  'Graphical
      TabIndex        =   8
      Top             =   2040
      Width           =   2775
   End
   Begin VB.ComboBox cboPemasok 
      Appearance      =   0  'Flat
      BackColor       =   &H80000009&
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   315
      Left            =   1920
      TabIndex        =   7
      Top             =   360
      Width           =   2295
   End
   Begin VB.TextBox txtNoTelepon 
      Appearance      =   0  'Flat
      BackColor       =   &H80000009&
      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            =   1920
      TabIndex        =   6
      Top             =   1440
      Width           =   2295
   End
   Begin VB.TextBox txtAlamatPemasok 
      Appearance      =   0  'Flat
      BackColor       =   &H80000009&
      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            =   1920
      TabIndex        =   4
      Top             =   1080
      Width           =   4815
   End
   Begin VB.TextBox txtNamaPemasok 
      Appearance      =   0  'Flat
      BackColor       =   &H80000009&
      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            =   1920
      TabIndex        =   2
      Top             =   720
      Width           =   3855
   End
   Begin VB.Label Label4 
      Appearance      =   0  'Flat
      BackColor       =   &H00C0E0FF&
      Caption         =   "No Telepon"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H80000008&
      Height          =   255
      Left            =   360
      TabIndex        =   5
      Top             =   1440
      Width           =   1575
   End
   Begin VB.Label Label3 
      Appearance      =   0  'Flat
      BackColor       =   &H00C0E0FF&
      Caption         =   "Alamat Pemasok"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H80000008&
      Height          =   255
      Left            =   360
      TabIndex        =   3
      Top             =   1080
      Width           =   1455
   End
   Begin VB.Label Label2 
      Appearance      =   0  'Flat
      BackColor       =   &H00C0E0FF&
      Caption         =   "Nama Pemasok"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H80000008&
      Height          =   255
      Left            =   360
      TabIndex        =   1
      Top             =   720
      Width           =   1335
   End
   Begin VB.Label Label1 
      Appearance      =   0  'Flat
      BackColor       =   &H00C0E0FF&
      Caption         =   "Kode Pemasok"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H80000008&
      Height          =   255
      Left            =   360
      TabIndex        =   0
      Top             =   360
      Width           =   1335
   End
   Begin VB.Menu mnu_keluar 
      Caption         =   "Keluar"
   End
End
Attribute VB_Name = "EditPemasok"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim conAVB As ADODB.Connection
Dim rsPemasok As ADODB.Recordset

Private Sub cboPemasok_Click()
  Dim strPemasok As String
  Dim vntBookMark As Variant
  strPemasok = "[Kode Pemasok]  = '" & cboPemasok & "'"
  With rsPemasok
      .MoveFirst
      .Find strPemasok
      txtNamaPemasok.Text = ![Nama Pemasok]
      txtAlamatPemasok.Text = ![Alamat Pemasok]
      txtNoTelepon.Text = ![No Telepon]
  End With
  txtNamaPemasok.Enabled = True
  txtAlamatPemasok.Enabled = True
  txtNoTelepon.Enabled = True
  cmdEdit.Enabled = True
End Sub

Private Sub cmdEdit_Click()
  On Error GoTo HandleErrors
  With rsPemasok
    ![Kode Pemasok] = cboPemasok.Text
    ![Nama Pemasok] = txtNamaPemasok.Text
    ![Alamat Pemasok] = txtAlamatPemasok.Text
    ![No Telepon] = txtNoTelepon.Text
    .Update
  End With
  txtNamaPemasok.Enabled = False
  txtAlamatPemasok.Enabled = False
  txtNoTelepon.Enabled = False
  cmdEdit.Enabled = False
  
  With rsPemasok
    While Not .EOF
      If Not .BOF Then
        cboPemasok.Clear
        .MoveNext
      End If
    Wend
  End With
  
  With rsPemasok
    .MoveFirst
    While Not .EOF
      If Not .BOF Then
        cboPemasok.AddItem ![Kode Pemasok]
        .MoveNext
      End If
    Wend
  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 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 rsPemasok = New ADODB.Recordset
  strSQL = "SELECT * FROM Pemasok"
    rsPemasok.Open strSQL, conAVB, adOpenDynamic, adLockOptimistic, adCmdText
  On Error GoTo 0
  With rsPemasok
    While Not .EOF
      If Not rsPemasok.BOF Then
        cboPemasok.AddItem ![Kode Pemasok]
        .MoveNext
      End If
    Wend
  End With
 
End Sub

Private Sub mnu_keluar_Click()
  Unload Me
End Sub

Private Sub txtAlamatPemasok_KeyPress(KeyAscii As Integer)
   KeyAscii = Asc(UCase(Chr(KeyAscii)))
End Sub

Private Sub txtNamaPemasok_KeyPress(KeyAscii As Integer)
   KeyAscii = Asc(UCase(Chr(KeyAscii)))
End Sub

