VERSION 5.00
Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "TABCTL32.OCX"
Begin VB.Form frmAnggota 
   Caption         =   ". . : :  A N G G O T A  : : . . "
   ClientHeight    =   3945
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   5025
   KeyPreview      =   -1  'True
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   3945
   ScaleWidth      =   5025
   Begin TabDlg.SSTab SSTabAnggota 
      Height          =   3375
      Left            =   120
      TabIndex        =   14
      Top             =   480
      Width           =   4815
      _ExtentX        =   8493
      _ExtentY        =   5953
      _Version        =   393216
      Tabs            =   2
      Tab             =   1
      TabHeight       =   520
      TabCaption(0)   =   "TAMBAH"
      Tab(0).ControlEnabled=   0   'False
      Tab(0).Control(0)=   "cmdTambahNew"
      Tab(0).Control(1)=   "txtTambahTelp"
      Tab(0).Control(2)=   "txtTambahAlamat"
      Tab(0).Control(3)=   "txtTambahId"
      Tab(0).Control(4)=   "txtTambahNama"
      Tab(0).Control(5)=   "cmdSave"
      Tab(0).Control(6)=   "cmdCancel"
      Tab(0).Control(7)=   "Label7"
      Tab(0).Control(8)=   "Label1"
      Tab(0).Control(9)=   "Label2"
      Tab(0).Control(10)=   "Label4"
      Tab(0).ControlCount=   11
      TabCaption(1)   =   "EDIT"
      Tab(1).ControlEnabled=   -1  'True
      Tab(1).Control(0)=   "Label3"
      Tab(1).Control(0).Enabled=   0   'False
      Tab(1).Control(1)=   "Label5"
      Tab(1).Control(1).Enabled=   0   'False
      Tab(1).Control(2)=   "Label6"
      Tab(1).Control(2).Enabled=   0   'False
      Tab(1).Control(3)=   "Label8"
      Tab(1).Control(3).Enabled=   0   'False
      Tab(1).Control(4)=   "cmdDelete"
      Tab(1).Control(4).Enabled=   0   'False
      Tab(1).Control(5)=   "cmdEditSave"
      Tab(1).Control(5).Enabled=   0   'False
      Tab(1).Control(6)=   "txtEditNama"
      Tab(1).Control(6).Enabled=   0   'False
      Tab(1).Control(7)=   "txtEditId"
      Tab(1).Control(7).Enabled=   0   'False
      Tab(1).Control(8)=   "txtEditAlamat"
      Tab(1).Control(8).Enabled=   0   'False
      Tab(1).Control(9)=   "txtEditTelp"
      Tab(1).Control(9).Enabled=   0   'False
      Tab(1).Control(10)=   "cmdView"
      Tab(1).Control(10).Enabled=   0   'False
      Tab(1).ControlCount=   11
      Begin VB.CommandButton cmdTambahNew 
         Caption         =   "&New"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   9.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   495
         Left            =   -74760
         TabIndex        =   4
         Top             =   2640
         Width           =   1215
      End
      Begin VB.CommandButton cmdView 
         Caption         =   "&View"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   9.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   495
         Left            =   3240
         TabIndex        =   13
         Top             =   2640
         Width           =   1215
      End
      Begin VB.TextBox txtEditTelp 
         Enabled         =   0   'False
         Height          =   375
         Left            =   1920
         MaxLength       =   13
         TabIndex        =   10
         Top             =   2040
         Width           =   2775
      End
      Begin VB.TextBox txtEditAlamat 
         Enabled         =   0   'False
         Height          =   375
         Left            =   1920
         TabIndex        =   9
         Top             =   1560
         Width           =   2775
      End
      Begin VB.TextBox txtTambahTelp 
         Enabled         =   0   'False
         Height          =   375
         Left            =   -73080
         MaxLength       =   13
         TabIndex        =   3
         Top             =   2040
         Width           =   2775
      End
      Begin VB.TextBox txtTambahAlamat 
         Enabled         =   0   'False
         Height          =   375
         Left            =   -73080
         TabIndex        =   2
         Top             =   1560
         Width           =   2775
      End
      Begin VB.TextBox txtEditId 
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   9.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   1920
         Locked          =   -1  'True
         TabIndex        =   7
         Top             =   600
         Width           =   2775
      End
      Begin VB.TextBox txtEditNama 
         Enabled         =   0   'False
         Height          =   375
         Left            =   1920
         TabIndex        =   8
         Top             =   1080
         Width           =   2775
      End
      Begin VB.CommandButton cmdEditSave 
         Caption         =   "&Save"
         Enabled         =   0   'False
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   9.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   495
         Left            =   240
         TabIndex        =   11
         Top             =   2640
         Width           =   1215
      End
      Begin VB.CommandButton cmdDelete 
         Caption         =   "&Delete"
         Enabled         =   0   'False
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   9.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   495
         Left            =   1800
         TabIndex        =   12
         Top             =   2640
         Width           =   1215
      End
      Begin VB.TextBox txtTambahId 
         Height          =   375
         Left            =   -73080
         Locked          =   -1  'True
         TabIndex        =   0
         Top             =   600
         Width           =   2775
      End
      Begin VB.TextBox txtTambahNama 
         Enabled         =   0   'False
         Height          =   375
         Left            =   -73080
         TabIndex        =   1
         Top             =   1080
         Width           =   2775
      End
      Begin VB.CommandButton cmdSave 
         Caption         =   "&Save"
         Enabled         =   0   'False
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   9.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   495
         Left            =   -73200
         TabIndex        =   5
         Top             =   2640
         Width           =   1215
      End
      Begin VB.CommandButton cmdCancel 
         Caption         =   "&Cancel"
         Enabled         =   0   'False
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   9.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   495
         Left            =   -71760
         TabIndex        =   6
         Top             =   2640
         Width           =   1215
      End
      Begin VB.Label Label8 
         Caption         =   "Telp"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   12
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   240
         TabIndex        =   22
         Top             =   2040
         Width           =   1335
      End
      Begin VB.Label Label7 
         Caption         =   "Telp"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   12
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   -74760
         TabIndex        =   21
         Top             =   2040
         Width           =   1095
      End
      Begin VB.Label Label6 
         AutoSize        =   -1  'True
         Caption         =   "ID Anggota"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   12
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   300
         Left            =   240
         TabIndex        =   20
         Top             =   600
         Width           =   1395
      End
      Begin VB.Label Label5 
         AutoSize        =   -1  'True
         Caption         =   "Nama"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   12
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   300
         Left            =   240
         TabIndex        =   19
         Top             =   1080
         Width           =   705
      End
      Begin VB.Label Label3 
         AutoSize        =   -1  'True
         Caption         =   "Alamat"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   12
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   300
         Left            =   240
         TabIndex        =   18
         Top             =   1560
         Width           =   855
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "ID Anggota"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   12
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   300
         Left            =   -74760
         TabIndex        =   17
         Top             =   600
         Width           =   1395
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         Caption         =   "Nama"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   12
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   300
         Left            =   -74760
         TabIndex        =   16
         Top             =   1080
         Width           =   705
      End
      Begin VB.Label Label4 
         AutoSize        =   -1  'True
         Caption         =   "Alamat"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   12
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   300
         Left            =   -74760
         TabIndex        =   15
         Top             =   1560
         Width           =   855
      End
   End
   Begin VB.Label Label9 
      Alignment       =   2  'Center
      Caption         =   "DATA ANGGOTA"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   13.5
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   0
      TabIndex        =   23
      Top             =   0
      Width           =   5055
   End
End
Attribute VB_Name = "frmAnggota"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Dim oldsize As Long
   
Private Sub Form_Resize()
    If Me.Width = oldsize Then
        Exit Sub
    Else
        CenterC Me
        oldsize = Me.Width
    End If
    If Me.Height <> 4455 Then Me.Height = 4455
    If Me.Width <> 5145 Then Me.Width = 5145
    
End Sub

Sub aktiftambah()
    txtTambahNama.Enabled = Not txtTambahNama.Enabled
    txtTambahAlamat.Enabled = Not txtTambahAlamat.Enabled
    txtTambahTelp.Enabled = Not txtTambahTelp.Enabled
    cmdCancel.Enabled = Not cmdCancel.Enabled
    cmdSave.Enabled = Not cmdSave.Enabled
    cmdTambahNew.Enabled = Not cmdTambahNew.Enabled
End Sub

Sub aktifedit()
    txtEditNama.Enabled = Not txtEditNama.Enabled
    txtEditAlamat.Enabled = Not txtEditAlamat.Enabled
    txtEditTelp.Enabled = Not txtEditTelp.Enabled
    cmdEditSave.Enabled = Not cmdEditSave.Enabled
    cmdDelete.Enabled = Not cmdDelete.Enabled
    cmdView.Enabled = Not cmdView.Enabled
End Sub

Private Sub cmdCancel_Click()
    txtTambahId = ""
    txtTambahNama = ""
    txtTambahAlamat = ""
    txtTambahTelp = ""
    aktiftambah
End Sub

Private Sub cmdDelete_Click()
    aktifedit
    conn.Execute "delete * from T_Anggota where [Id Anggota]='" & txtEditId & "'"
    txtEditNama = ""
    txtEditId = ""
    txtEditAlamat = ""
    txtEditTelp = ""
End Sub

Private Sub cmdEditSave_Click()
    aktifedit
    If txtEditNama = "" And txtEditId = "" And txtEditAlamat = "" And txtEditTelp = "" Then
    
    Else
        conn.Execute "Update T_Anggota set [Id Anggota]='" & txtEditId.Text & "',[Nama]='" & txtEditNama.Text & "',[Alamat]='" & txtEditAlamat.Text & "',[Telp]='" & txtEditTelp.Text & "' where [ID Anggota]= '" & txtEditId & "'"
        txtEditId = ""
        txtEditNama = ""
        txtEditAlamat = ""
        txtEditTelp = ""
    End If
End Sub

Private Sub cmdSave_Click()
    conn.Execute "insert into T_Anggota values('" & txtTambahId & "','" & txtTambahNama & "','" & txtTambahAlamat & "','" & txtTambahTelp & "')"
    txtTambahId = ""
    txtTambahNama = ""
    txtTambahAlamat = ""
    txtTambahTelp = ""
    aktiftambah
End Sub

Private Sub cmdTambahNew_Click()
aktiftambah
Dim thkom, threc, no
    thkom = Format(Date, "YY")
    If rec.State = 1 Then rec.Close
    rec.Open "select [Id Anggota] from T_Anggota", conn, 3, 3
    If Not rec.EOF Then
        rec.MoveLast
        threc = Left(rec("Id Anggota"), 2)
        If threc = thkom Then
            no = Val(Right(rec("Id Anggota"), 3)) + 1
            no = threc & String(3 - Len(no), "0") & no
        Else
            no = thkom & "001"
        End If
    Else
        no = thkom & "001"
    End If
    txtTambahId = no
    txtTambahNama.SetFocus
End Sub

Private Sub cmdView_Click()
    frmViewDataAnggota.Show 1
    aktifedit
End Sub

Private Sub Form_Load()
    Me.Height = 4455
    Me.Width = 5145
    CenterC Me
    oldsize = Me.Width
End Sub

Private Sub SSTabAnggota_Click(PreviousTab As Integer)
    If SSTabAnggota.Caption = "TAMBAH" Then
        txtEditId = ""
        txtEditNama = ""
        txtEditAlamat = ""
        txtEditTelp = ""
        If txtEditNama.Enabled = True Then aktifedit
    ElseIf SSTabAnggota.Caption = "EDIT" Then
        txtTambahId = ""
        txtTambahNama = ""
        txtTambahAlamat = ""
        txtTambahTelp = ""
        If txtTambahNama.Enabled = True Then aktiftambah
    End If
End Sub

Private Sub Form_KeyPress(KeyAscii As Integer)
    If KeyAscii = vbKeyReturn Then
        SendKeys ("{TAB}")
        KeyAscii = 0
    End If
End Sub

Private Sub txtEditTelp_Change()
    If IsNumeric(txtEditTelp) = False Then
        txtEditTelp = ""
    End If
End Sub

Private Sub txtTambahTelp_Change()
    If IsNumeric(txtTambahTelp) = False Then
        txtTambahTelp = ""
    End If
End Sub

Private Sub txtTambahTelp_KeyPress(KeyAscii As Integer)
    If KeyAscii = vbKeyReturn Then
        cmdSave.Value = True
    End If
End Sub

Private Sub txtEditTelp_KeyPress(KeyAscii As Integer)
    If KeyAscii = vbKeyReturn Then
        cmdEditSave.Value = True
    End If
End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Dim cepat As Long
    cepat = 1000
    While Left + Width < Screen.Width
        DoEvents
        Left = Left + cepat
    Wend
    While Top - Height < Screen.Height
        DoEvents
        Top = Top + cepat
    Wend
    Unload Me
End Sub
