VERSION 5.00
Begin VB.Form Form_cambio_apo_prox 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Cambio de Apoderado"
   ClientHeight    =   8100
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   11190
   Icon            =   "Form_cambio_apo_prox.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   8100
   ScaleWidth      =   11190
   Begin VB.ListBox list_rut 
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1530
      Left            =   6240
      TabIndex        =   6
      Top             =   720
      Visible         =   0   'False
      Width           =   1455
   End
   Begin VB.ListBox list_nombre 
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1530
      Left            =   960
      TabIndex        =   7
      Top             =   720
      Visible         =   0   'False
      Width           =   4575
   End
   Begin VB.Frame Frame1 
      Caption         =   "Datos Alumnos"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C00000&
      Height          =   1095
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   10935
      Begin VB.CommandButton cmb_cambiar 
         Caption         =   "Otro Alumno"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   735
         Left            =   9480
         Picture         =   "Form_cambio_apo_prox.frx":2A8B2
         Style           =   1  'Graphical
         TabIndex        =   43
         Top             =   240
         Width           =   1335
      End
      Begin VB.TextBox txt_nombre 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   840
         TabIndex        =   3
         Top             =   360
         Width           =   4575
      End
      Begin VB.TextBox txt_rut 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   6120
         TabIndex        =   2
         Top             =   360
         Width           =   1455
      End
      Begin VB.Label Label3 
         Caption         =   "Desplácese utilizando la tecla 'Enter' de su teclado para llenar los campos."
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00C00000&
         Height          =   255
         Left            =   120
         TabIndex        =   50
         Top             =   720
         Width           =   7455
      End
      Begin VB.Label lb_mensaje 
         Caption         =   "Mensaje"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H000000FF&
         Height          =   255
         Left            =   120
         TabIndex        =   8
         Top             =   720
         Width           =   3615
      End
      Begin VB.Label Label1 
         Caption         =   "Nombre:"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   120
         TabIndex        =   5
         Top             =   360
         Width           =   735
      End
      Begin VB.Label Label2 
         Caption         =   "Run:"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   5640
         TabIndex        =   4
         Top             =   360
         Width           =   495
      End
   End
   Begin VB.Frame Frame2 
      Caption         =   "Datos de Apoderado"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C00000&
      Height          =   6615
      Left            =   120
      TabIndex        =   1
      Top             =   1320
      Width           =   10935
      Begin VB.CommandButton guardar 
         Caption         =   "Guardar Cambios"
         Enabled         =   0   'False
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   855
         Left            =   7560
         Picture         =   "Form_cambio_apo_prox.frx":2AED8
         Style           =   1  'Graphical
         TabIndex        =   48
         Top             =   5640
         Width           =   1575
      End
      Begin VB.CommandButton cmb_Cancelar 
         Caption         =   "Cancelar"
         Enabled         =   0   'False
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   855
         Left            =   9240
         Picture         =   "Form_cambio_apo_prox.frx":2B531
         Style           =   1  'Graphical
         TabIndex        =   47
         Top             =   5640
         Width           =   1575
      End
      Begin VB.ComboBox Cmd_agno 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   330
         ItemData        =   "Form_cambio_apo_prox.frx":2B899
         Left            =   840
         List            =   "Form_cambio_apo_prox.frx":2B8A3
         Style           =   2  'Dropdown List
         TabIndex        =   45
         Top             =   360
         Width           =   1335
      End
      Begin VB.CommandButton cmb_cam_apo 
         Caption         =   "Cambiar Apoderado"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   855
         Left            =   9240
         Picture         =   "Form_cambio_apo_prox.frx":2B8AF
         Style           =   1  'Graphical
         TabIndex        =   44
         Top             =   240
         Width           =   1575
      End
      Begin VB.Frame Frame_apo 
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   4455
         Left            =   120
         TabIndex        =   11
         Top             =   1080
         Width           =   10695
         Begin VB.TextBox txt_fon_apo 
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   285
            Left            =   2640
            MaxLength       =   8
            TabIndex        =   26
            TabStop         =   0   'False
            Top             =   1680
            Width           =   1455
         End
         Begin VB.TextBox txt_fon_emp_apo 
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   285
            Left            =   2640
            MaxLength       =   8
            TabIndex        =   25
            TabStop         =   0   'False
            Top             =   3240
            Width           =   1455
         End
         Begin VB.TextBox txt_pro_apo 
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   285
            Left            =   2640
            MaxLength       =   25
            TabIndex        =   24
            TabStop         =   0   'False
            Top             =   2880
            Width           =   2775
         End
         Begin VB.TextBox txt_apm_apo 
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   285
            Left            =   7800
            MaxLength       =   20
            TabIndex        =   23
            TabStop         =   0   'False
            Top             =   600
            Width           =   2535
         End
         Begin VB.TextBox txt_dir_apo 
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   285
            Left            =   2640
            MaxLength       =   40
            TabIndex        =   22
            TabStop         =   0   'False
            Top             =   960
            Width           =   2775
         End
         Begin VB.TextBox txt_nom_Apo 
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   285
            Left            =   2640
            MaxLength       =   30
            TabIndex        =   21
            TabStop         =   0   'False
            Top             =   240
            Width           =   2775
         End
         Begin VB.TextBox TXT_APP_APO 
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   285
            Left            =   2640
            MaxLength       =   20
            TabIndex        =   20
            TabStop         =   0   'False
            Top             =   600
            Width           =   2775
         End
         Begin VB.ComboBox cmb_con_apo 
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   330
            ItemData        =   "Form_cambio_apo_prox.frx":2BE30
            Left            =   2640
            List            =   "Form_cambio_apo_prox.frx":2BE32
            TabIndex        =   19
            TabStop         =   0   'False
            Top             =   3960
            Width           =   2775
         End
         Begin VB.ComboBox cmb_tip_apo 
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   330
            ItemData        =   "Form_cambio_apo_prox.frx":2BE34
            Left            =   7800
            List            =   "Form_cambio_apo_prox.frx":2BE36
            TabIndex        =   18
            TabStop         =   0   'False
            Top             =   3960
            Width           =   2535
         End
         Begin VB.TextBox txt_cel_apo 
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   285
            Left            =   7800
            MaxLength       =   12
            TabIndex        =   17
            TabStop         =   0   'False
            Top             =   1680
            Width           =   1455
         End
         Begin VB.ComboBox cmb_com_apo 
            Enabled         =   0   'False
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   330
            ItemData        =   "Form_cambio_apo_prox.frx":2BE38
            Left            =   2640
            List            =   "Form_cambio_apo_prox.frx":2BE3A
            TabIndex        =   16
            TabStop         =   0   'False
            Top             =   1320
            Width           =   2775
         End
         Begin VB.ComboBox cmb_niv_apo 
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   330
            ItemData        =   "Form_cambio_apo_prox.frx":2BE3C
            Left            =   2640
            List            =   "Form_cambio_apo_prox.frx":2BE61
            TabIndex        =   15
            TabStop         =   0   'False
            Top             =   2520
            Width           =   2775
         End
         Begin VB.ComboBox cmb_reg_apo 
            Enabled         =   0   'False
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   330
            ItemData        =   "Form_cambio_apo_prox.frx":2BF2A
            Left            =   7800
            List            =   "Form_cambio_apo_prox.frx":2BF31
            Style           =   1  'Simple Combo
            TabIndex        =   14
            Top             =   1320
            Width           =   2535
         End
         Begin VB.TextBox txt_emp_apo 
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   285
            Left            =   7800
            MaxLength       =   25
            TabIndex        =   13
            TabStop         =   0   'False
            Top             =   2880
            Width           =   2535
         End
         Begin VB.ComboBox cmb_par_apo 
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   330
            ItemData        =   "Form_cambio_apo_prox.frx":2BF38
            Left            =   7800
            List            =   "Form_cambio_apo_prox.frx":2BF54
            TabIndex        =   12
            TabStop         =   0   'False
            Top             =   2520
            Width           =   2535
         End
         Begin VB.Label lbl_fon_apo 
            Caption         =   "Fono"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Left            =   240
            TabIndex        =   41
            Top             =   1680
            Width           =   1455
         End
         Begin VB.Label lbl_fon_emp_apo 
            Caption         =   "Fono Empresa"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Left            =   240
            TabIndex        =   40
            Top             =   3240
            Width           =   1455
         End
         Begin VB.Label lbl_par_apo 
            Caption         =   "Parentesco Alumno"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Left            =   5880
            TabIndex        =   39
            Top             =   2520
            Width           =   1455
         End
         Begin VB.Label lbl_pro_apo 
            Caption         =   "Ocupación"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Left            =   240
            TabIndex        =   38
            Top             =   2880
            Width           =   1095
         End
         Begin VB.Label lbl_com_apo 
            Caption         =   "Comuna"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Left            =   240
            TabIndex        =   37
            Top             =   1320
            Width           =   1335
         End
         Begin VB.Label LBL_APM_apo 
            Caption         =   "Apellido Materno"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Left            =   5880
            TabIndex        =   36
            Top             =   600
            Width           =   1575
         End
         Begin VB.Label lbl_niv_apo 
            Caption         =   "Nivel Educacional"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Left            =   240
            TabIndex        =   35
            Top             =   2520
            Width           =   2295
         End
         Begin VB.Label lbl_dir_apo 
            Caption         =   "Dirección"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Left            =   240
            TabIndex        =   34
            Top             =   960
            Width           =   1095
         End
         Begin VB.Label lbl_nom_apo 
            Caption         =   "Nombres"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Left            =   240
            TabIndex        =   33
            Top             =   240
            Width           =   1095
         End
         Begin VB.Label LBL_APP_APO 
            Caption         =   "Apellido Paterno"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Left            =   240
            TabIndex        =   32
            Top             =   600
            Width           =   2175
         End
         Begin VB.Label lbl_con 
            Caption         =   "Convenio"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Left            =   240
            TabIndex        =   31
            Top             =   3960
            Width           =   1335
         End
         Begin VB.Label lbl_tip_apo 
            Caption         =   "Tipo de Apoderado"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Left            =   5880
            TabIndex        =   30
            Top             =   3960
            Width           =   1695
         End
         Begin VB.Label lbl_cel_apo 
            Caption         =   "Celular"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Left            =   5880
            TabIndex        =   29
            Top             =   1680
            Width           =   1095
         End
         Begin VB.Line Line5 
            BorderColor     =   &H80000010&
            X1              =   15
            X2              =   10680
            Y1              =   3720
            Y2              =   3720
         End
         Begin VB.Line Line6 
            BorderColor     =   &H80000010&
            X1              =   15
            X2              =   10680
            Y1              =   2280
            Y2              =   2280
         End
         Begin VB.Line Line7 
            BorderColor     =   &H80000005&
            X1              =   15
            X2              =   10680
            Y1              =   2295
            Y2              =   2295
         End
         Begin VB.Line Line8 
            BorderColor     =   &H80000005&
            X1              =   15
            X2              =   10680
            Y1              =   3735
            Y2              =   3735
         End
         Begin VB.Label LBL_reg_apo 
            Caption         =   "Región"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Left            =   5880
            TabIndex        =   28
            Top             =   1320
            Width           =   1815
         End
         Begin VB.Label LBL_EMP_apo 
            Caption         =   "Empresa donde Trabaja"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Left            =   5880
            TabIndex        =   27
            Top             =   2880
            Width           =   1935
         End
      End
      Begin VB.TextBox txt_dig_apo 
         Enabled         =   0   'False
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   2160
         MaxLength       =   1
         TabIndex        =   10
         TabStop         =   0   'False
         Top             =   840
         Width           =   255
      End
      Begin VB.TextBox txt_rut_apo 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   840
         MaxLength       =   8
         TabIndex        =   9
         TabStop         =   0   'False
         Top             =   840
         Width           =   1215
      End
      Begin VB.Label lb_advertencia 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   9
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H000000FF&
         Height          =   735
         Left            =   2640
         TabIndex        =   49
         Top             =   360
         Width           =   6495
      End
      Begin VB.Label Txt_nac_Alu 
         Caption         =   "Año:"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00C00000&
         Height          =   375
         Left            =   240
         TabIndex        =   46
         Top             =   360
         Width           =   735
      End
      Begin VB.Label lbl_rut_apo 
         Caption         =   "Rut"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   240
         TabIndex        =   42
         Top             =   840
         Width           =   1095
      End
   End
End
Attribute VB_Name = "Form_cambio_apo_prox"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Flag_sub As Boolean
Dim Flag_proc As Boolean
Dim strDatApo(20) As String
Dim RutOld, RutNew, NombreAnt As String

Private Sub cmb_cam_apo_Click()
Cmd_agno.Enabled = False

   ' If cmb_cam_apo.Caption = "Cambiar Apoderado" Then
        RutOld = txt_rut_apo.Text & "-" & txt_dig_apo.Text
        NombreAnt = txt_nom_apo.Text & " " & TXT_APP_APO.Text & " " & txt_apm_apo.Text
        LimpiaCampos True
        lb_advertencia.Caption = "Está realizando un cambio de apoderado para el año " & Cmd_agno.Text & ", si este no es el año deseado presione el botón 'Cancelar' y luego seleccione el año deseado."
        cmb_con_apo.Text = "NINGUNO"
        cmb_tip_apo.ListIndex = 0
        cmb_tip_apo.Enabled = False
        Me.txt_rut_apo.Enabled = True
        'cmb_cam_apo.Caption = "Guardar Cambios"
        guardar.Enabled = True
        cmb_cam_apo.Enabled = False
        cmb_Cancelar.Enabled = True
        
    'Else
       ' If MsgBox("Esta seguro que desea cambiar de apoderado al alumno " & txt_nombre.Text & vbLf & "Apoderado Atinguo : " & NombreAnt & ", Rut : " & RutOld & vbLf & "Por Nuevo apoderado : " & txt_nom_Apo.Text & " " & TXT_APP_APO.Text & " " & txt_apm_apo.Text & ", Rut : " & txt_rut_apo.Text & "-" & txt_dig_apo.Text & vbLf & "Para el año : " & Cmd_agno.Text, vbQuestion + vbYesNo) = vbYes Then
          '  cmb_cam_apo.Enabled = False
           ' lb_advertencia.Caption = ""
          '  cmb_cam_apo.Refresh
           ' cmb_Cancelar.Enabled = False
           ' Flag_proc = True
           ' cambia_datos
           ' Flag_proc = False
           ' cmb_cam_apo.Enabled = True
            'cmb_Cancelar.Enabled = True
      '  End If
   ' End If
End Sub

Private Sub cambia_datos()
    Dim var_sql As String
    Dim log As Boolean
    Dim accion_realizada As String
    Dim Rs_Apo As ADODB.Recordset
    Set Rs_Apo = New ADODB.Recordset
    Rs_Apo.CursorType = adOpenDynamic
    Rs_Apo.LockType = adLockOptimistic
    Rs_Apo.CursorLocation = adUseClient
    
    
    If Len(Trim(Me.txt_rut_apo.Text)) = 0 Then Call validatexto(txt_rut_apo, "Ingrese Rut del Apoderado"): Exit Sub
    
    If Len(Trim(Me.txt_nom_apo.Text)) = 0 Then Call validatexto(txt_nom_apo, "Ingrese Nombre del Apoderado"): Exit Sub
    If Len(Trim(Me.TXT_APP_APO.Text)) = 0 Then
        Call validatexto(TXT_APP_APO, "Ingrese Apellido Paterno del Apoderado")
        Exit Sub
    Else
    If Me.cmb_par_apo.Text = "Madre" Then
        If UCase(Trim(DevuelveCampo("postulantes", "", "ape_mat_alu", " ci_alu = '" & txt_Rut.Text & "'", conn))) <> UCase(Trim(Me.TXT_APP_APO.Text)) Then
            If MsgBox("No hay relación de apellidos entre Madre e Hijo" & Chr(13) & chr13 & Chr(13) & "Apellido Madre ->  " & Me.TXT_APP_APO.Text & Chr(13) & "Apellido Hijo     ->  " & DevuelveCampo("postulantes", "", "ape_mat_alu", " ci_alu = '" & txt_Rut.Text & "'", conn) & Chr(13) & Chr(13) & "Corrija el apellido que corresponda" & Chr(13) & "o verifique la opción de parentesco." & Chr(13) & Chr(13) & "¿Desea continuar?", vbYesNo + vbQuestion) = vbNo Then
                'Me.TXT_APP_APO.Text = Me.txt_apm_alu.Text
                Me.TXT_APP_APO.SetFocus
                Exit Sub
            End If
        End If
    ElseIf Me.cmb_par_apo.Text = "Padre" Then
        If UCase(Trim(DevuelveCampo("postulantes", "", "ape_pat_alu", " ci_alu = '" & txt_Rut.Text & "'", conn))) <> UCase(Trim(Me.TXT_APP_APO.Text)) Then
            If MsgBox("No hay relación de apellidos entre Padre e Hijo" & Chr(13) & chr13 & Chr(13) & "Apellido Padre ->  " & Me.TXT_APP_APO.Text & Chr(13) & "Apellido Hijo     ->  " & DevuelveCampo("postulantes", "", "ape_pat_alu", " ci_alu = '" & txt_Rut.Text & "'", conn) & Chr(13) & Chr(13) & "Corrija el apellido que corresponda" & Chr(13) & "o verifique la opción de parentesco." & Chr(13) & Chr(13) & "¿Desea continuar?", vbYesNo + vbQuestion) = vbNo Then
                'Me.TXT_APP_APO.Text = Me.txt_app_alu.Text
                Me.TXT_APP_APO.SetFocus
                Exit Sub
            End If
        End If
    End If
    End If
    If Len(Trim(Me.txt_apm_apo.Text)) = 0 Then Call validatexto(txt_apm_apo, "Ingrese Apellido Materno del Apoderado "): Exit Sub
    If Len(Trim(Me.txt_dir_apo.Text)) = 0 Then Call validatexto(txt_dir_apo, "Ingrese Dirección del Apoderado"): Exit Sub
    If Len(Trim(Me.txt_fon_apo.Text)) = 0 Then Call validatexto(txt_fon_apo, "Ingrese Fono del Apoderado"): Exit Sub
    If Len(Trim(Me.cmb_niv_apo.Text)) = 0 Then MsgBox ("Ingrese Nivel Educacional del Apoderado"): Me.cmb_niv_apo.Enabled = True: Me.cmb_niv_apo.SetFocus: Exit Sub
    If Len(Trim(Me.cmb_par_apo.Text)) = 0 Then MsgBox ("Ingrese Parentesco del Apoderado"): Me.cmb_par_apo.Enabled = True: Me.cmb_par_apo.SetFocus: Exit Sub
    rut_apo = Trim(txt_rut_apo) + "-" + Trim(txt_dig_apo)
            If ExistReg("apoderados", "rut_apo ='" & rut_apo & "'", conn) Then
                
                txt_rut_apo.Enabled = False
                txt_dig_apo.Enabled = False
                'Editando Apoderado
                Rs_Apo.Open "SELECT * FROM apoderados where " & "rut_apo ='" & rut_apo & "'", conn
                'Rs_Apo!rut_apo = rut_apo
                Rs_Apo!cod_tipo_apo = DevuelveCampo("tipo_apo", "", "cod_tipo_apo", "des_tipo_apo ='" & cmb_tip_apo & "'", conn)
                Rs_Apo!Noms_Apo = UCase(Trim(txt_nom_apo))
                Rs_Apo!ape1_apo = UCase(Trim(TXT_APP_APO))
                Rs_Apo!ape2_apo = UCase(Trim(txt_apm_apo))
                
                Rs_Apo!dir_apo = UCase(Trim(txt_dir_apo))
                Rs_Apo!comuna_apo = DevuelveCampo("codigos__geograficos", "", "cod_geo", "comuna ='" & cmb_com_apo & "'", conn)
                Rs_Apo!fon_c_apo = Trim(txt_fon_apo)
                Rs_Apo!cel_apo = Trim(txt_cel_apo)
                Rs_Apo!nivel_educ_apo = Trim(cmb_niv_apo)
                Rs_Apo!profesio_apo = Trim(txt_pro_apo)
                Rs_Apo!empresa = Trim(txt_emp_apo)
                Rs_Apo!empresa_fon = Trim(txt_fon_emp_apo)
                Rs_Apo!cod_conv = DevuelveCampo("CONVENIOS", "", "COD_CONV", "DES_CONV ='" & cmb_con_apo & "'", conn)
                Rs_Apo.Update
                Rs_Apo.Close
                'FIN Editando Apoderado
                
            Else
                '******* 1 *******
                'Guardando Apoderado
                Rs_Apo.Open "apoderados", conn, , , adCmdTable
                Rs_Apo.AddNew
                Rs_Apo!rut_apo = Trim(rut_apo)
                Rs_Apo!cod_tipo_apo = DevuelveCampo("tipo_apo", "", "cod_tipo_apo", "des_tipo_apo ='" & cmb_tip_apo & "'", conn)
                Rs_Apo!Noms_Apo = UCase(Trim(txt_nom_apo))
                Rs_Apo!ape1_apo = UCase(Trim(TXT_APP_APO))
                Rs_Apo!ape2_apo = UCase(Trim(txt_apm_apo))
                Rs_Apo!dir_apo = UCase(Trim(txt_dir_apo))
                Rs_Apo!comuna_apo = DevuelveCampo("codigos__geograficos", "", "cod_geo", "comuna ='" & cmb_com_apo & "'", conn)
                Rs_Apo!fon_c_apo = Trim(txt_fon_apo)
                Rs_Apo!cel_apo = Trim(txt_cel_apo)
                Rs_Apo!nivel_educ_apo = Trim(cmb_niv_apo)
                Rs_Apo!profesio_apo = Trim(txt_pro_apo)
                Rs_Apo!empresa = Trim(txt_emp_apo)
                Rs_Apo!empresa_fon = Trim(txt_fon_emp_apo)
                Rs_Apo!cod_conv = DevuelveCampo("CONVENIOS", "", "COD_CONV", "DES_CONV ='" & cmb_con_apo & "'", conn)
                Rs_Apo.Update
                Rs_Apo.Close
                '***** FIN Guardar apoderado ******
            End If
            
            
    var_sql = "DELETE FROM apo_x_alu WHERE ci_alu = '" & CStr(txt_Rut.Text) & "' AND agno = '" & Cmd_agno.Text & "'"
    conn.Execute var_sql
    var_sql = "INSERT INTO apo_x_alu(rut_apo,ci_alu,parent_apo,agno) VALUES('" & Trim(rut_apo) & "','" & txt_Rut.Text & "','" & cmb_par_apo.Text & "','" & Cmd_agno.Text & "')"
    conn.Execute var_sql

    ' Cheques cambio apoderado
    var_sql = "UPDATE fnza_cheques_recibidos SET run_apo = '" & Trim(rut_apo) & "' WHERE agno = " & Cmd_agno.Text _
            & " AND run_apo = '" & RutOld & "'"
    conn.Execute var_sql
  
    conn.Execute "UPDATE apo_x_alu SET rut_Apo = '" & Trim(rut_apo) & "', parent_apo = '" & cmb_par_apo.Text & "' where ci_alu = '" & txt_Rut.Text & "' and agno = " & Cmd_agno.Text
    RutNew = rut_apo
    actualiza_FnZa
    genera_log "Cambio apoderado alumno rut : " & txt_Rut.Text & vbLf & "Apoderado Antiguo : " & RutOld & vbLf & " Nuevo Apoderado : " & RutNew & vbLf & " Para el año : " & Cmd_agno.Text
    cmb_cam_apo.Caption = "Cambio Apoderado"
    cmb_Cancelar.Enabled = False
    cmb_cam_apo.Enabled = True
    cmb_cam_apo.Refresh
    
    'Inserta log
            NombreNew = txt_nom_apo.Text & " " & TXT_APP_APO.Text & " " & txt_apm_apo.Text
            accion_realizada = "El alumno a dejado de tener a " & CStr(NombreAnt) _
                             & " Rut " & CStr(RutOld) & " como apoderado"
            log = Inserta_Vitacora_Alumno(CStr(txt_Rut), accion_realizada)
            accion_realizada = "El nuevo apoderado del alumno es " & NombreNew _
                             & " Rut " & CStr(RutNew)
            log = Inserta_Vitacora_Alumno(CStr(txt_Rut), accion_realizada)
            'log = inserta_vitacora_alumno(CStr(txt_Rut), "", CStr(RutNew), CStr(RutOld), NombreNew, CStr(NombreAnt), "cam_apo", "", "", "1111-11-11", 0)
    'Fin de log
    
    MsgBox "Cambio Realizado"
End Sub

Private Sub actualiza_FnZa()
    Dim RsAux As ADODB.Recordset
    Dim RsAux2 As ADODB.Recordset
    Dim CantOld, CantNew As Integer
        
    Set RsAux = New ADODB.Recordset
    Set RsAux2 = New ADODB.Recordset
    If RutOld = RutNew Then Exit Sub
    RsAux.Open "SELECT axa.rut_apo,axa.ci_alu FROM apo_x_alu axa, matriculas m WHERE axa.rut_apo = '" & RutOld & "' and m.ci_alu = axa.ci_alu and m.anno_mat = " & Cmd_agno.Text, conn
    CantOld = RsAux.RecordCount
    RsAux.Close
    RsAux.Open "SELECT axa.rut_apo,axa.ci_alu FROM apo_x_alu axa, matriculas m WHERE axa.rut_apo = '" & RutNew & "'  and m.ci_alu = axa.ci_alu and m.anno_mat = " & Cmd_agno.Text, conn
    CantNew = RsAux.RecordCount
    RsAux.Close
    If CantOld = 0 And CantNew = 1 Then
        colegio = DevuelveCampo("fnza_detalle_mensualidad", "", "distinct colegio", "run_alu = '" & Trim(txt_Rut.Text) & "' and agno = '" & Trim(Cmd_agno.Text) & "'", conn)
        If colegio <> "" Then
            For I = 1 To 12
                Folio = num_folio_mens(Trim(RutOld), colegio, I, Cmd_agno.Text, conn)
                If Folio <> 0 Then conn.Execute "UPDATE fnza_mensualidad SET run_apo = '" & RutNew & "' WHERE folio_mens = " & Folio
            Next I
        End If
    End If
    If CantOld > 0 And CantNew = 1 Then
        colegio = DevuelveCampo("fnza_detalle_mensualidad", "", "distinct colegio", "run_alu = '" & Trim(txt_Rut.Text) & "' and agno = '" & Trim(Cmd_agno.Text) & "'", conn)
        If colegio <> "" Then
            For I = 1 To 12
                Folio = num_folio_mens(Trim(RutOld), colegio, I, Cmd_agno.Text, conn)

                RsAux.Open "SELECT folio_dtll FROM fnza_detalle_mensualidad WHERE folio_mens = " & Folio & " AND run_alu = '" & Trim(txt_Rut.Text) & "' AND mes = " & I, conn
                If RsAux.RecordCount > 0 And Folio <> 0 Then
                    nfolio = crear_folio_mens(Trim(RutNew), colegio, I, Trim(Cmd_agno.Text), conn)
                    conn.Execute "UPDATE fnza_detalle_mensualidad SET folio_mens = " & nfolio & " WHERE folio_mens = " & Folio & " AND run_alu = '" & Trim(txt_Rut.Text) & "' AND mes = " & I
                End If
                RsAux.Close
            Next I
        End If
    End If
    If CantOld > 0 And CantNew > 1 Then
        colegio = DevuelveCampo("fnza_detalle_mensualidad", "", "distinct colegio", "run_alu = '" & Trim(txt_Rut.Text) & "' and agno = '" & Trim(Cmd_agno.Text) & "'", conn)
        If colegio <> "" Then
            For I = 1 To 12
                Folio = num_folio_mens(Trim(RutOld), colegio, I, Cmd_agno.Text, conn)
                
                RsAux.Open "SELECT folio_dtll FROM fnza_detalle_mensualidad WHERE folio_mens = " & Folio & " AND run_alu = '" & Trim(txt_Rut.Text) & "' AND mes = " & I, conn
                If RsAux.RecordCount > 0 And Folio <> 0 Then
                    nfolio = num_folio_mens(Trim(RutNew), colegio, I, Cmd_agno.Text, conn)
                    If nfolio = 0 Then
                        nfolio = crear_folio_mens(Trim(RutNew), colegio, I, Trim(Cmd_agno.Text), conn)
                    End If
                    conn.Execute "UPDATE fnza_detalle_mensualidad SET folio_mens = " & nfolio & " WHERE folio_mens = " & Folio & " AND run_alu = '" & Trim(txt_Rut.Text) & "' AND mes = " & I
                End If
                RsAux.Close
            Next I
        End If
    End If

    If CantOld = 0 And CantNew > 1 Then
        colegio = DevuelveCampo("fnza_detalle_mensualidad", "", "distinct colegio", "run_alu = '" & Trim(txt_Rut.Text) & "' and agno = '" & Trim(Cmd_agno.Text) & "'", conn)
        If colegio <> "" Then
            For I = 1 To 12
                Folio = num_folio_mens(Trim(RutOld), colegio, I, Cmd_agno.Text, conn)
                
                RsAux.Open "SELECT folio_dtll FROM fnza_detalle_mensualidad WHERE folio_mens = " & Folio & " AND run_alu = '" & Trim(txt_Rut.Text) & "' AND mes = " & I, conn
                If RsAux.RecordCount > 0 And Folio <> 0 Then
                    nfolio = num_folio_mens(Trim(RutNew), colegio, I, Cmd_agno.Text, conn)
                    If nfolio = 0 Then
                        nfolio = crear_folio_mens(Trim(RutNew), colegio, I, Trim(Cmd_agno.Text), conn)
                    End If
                    conn.Execute "UPDATE fnza_detalle_mensualidad SET folio_mens = " & nfolio & " WHERE folio_mens = " & Folio & " AND run_alu = '" & Trim(txt_Rut.Text) & "' AND mes = " & I
                End If
                RsAux.Close
                conn.Execute "DELETE FROM fnza_mensualidad WHERE folio_mens = " & Folio & " AND run_apo = '" & Trim(RutOld) & "' and agno = " & Cmd_agno.Text
            Next I
        End If
    End If
    RecalculaCuota_Apo Trim(RutNew), Cmd_agno.Text, conn
    If CantOld > 0 Then RecalculaCuota_Apo Trim(RutOld), Cmd_agno.Text, conn
    conn.Execute "update fnza_letra_cab set estado_letra='A' where run_apo='" & RutOld & "' and agno = " & Cmd_agno.Text & " and estado_letra <> 'A'"
    
        
End Sub
Private Sub cmb_cambiar_Click()
    Flag_sub = True
    txt_Rut.Text = ""
    txt_nombre.Text = ""
    lb_advertencia.Caption = ""
    txt_Rut.Enabled = True
    txt_nombre.Enabled = True
    LimpiaCampos False
    cmb_cam_apo.Caption = "Cambio Apoderado"
    cmb_Cancelar.Enabled = False
    Flag_sub = False
End Sub

Private Sub cmb_cancelar_Click()
Cmd_agno.Enabled = True

    cmb_cam_apo.Caption = "Cambio Apoderado"
    cmb_Cancelar.Enabled = False
    lb_advertencia.Caption = ""
    Dim RC As ADODB.Recordset
    Set RC = New ADODB.Recordset
    llena_info_adicional
    Cmd_agno.Enabled = True
    cmb_Cancelar.Enabled = False
End Sub

Private Sub Cmd_agno_Click()
    If Not Flag_sub Then llena_info_adicional
End Sub

Private Sub Command1_Click()
    Dim RsAux As ADODB.Recordset
    Set RsAux = New ADODB.Recordset
    CantOld = 0
    CantNew = 1
    RutNew = "07663575-7"
    RutOld = "07481911-7"
    If CantOld = 0 And CantNew = 1 Then
        colegio = DevuelveCampo("fnza_detalle_mensualidad", "", "distinct colegio", "run_alu = '" & Trim(txt_Rut.Text) & "' and agno = '2006'", conn)
        If colegio <> "" Then
            For I = 1 To 12
                'Folio = num_folio_mens(Trim(RutOld), Colegio, i, Cmd_agno.Text, conn)
                RsAux.Open "SELECT folio_dtll FROM fnza_detalle_mensualidad WHERE run_alu = '" & Trim(txt_Rut.Text) & "' AND mes = " & I & " and agno = " & Cmd_agno.Text, conn
                If RsAux.RecordCount > 0 Then
                    nfolio = crear_folio_mens(Trim(RutNew), colegio, I, Trim(Cmd_agno.Text), conn)
                    'nfolio = num_folio_mens(Trim(RutNew), Colegio, i, Cmd_agno.Text, conn)
                    conn.Execute "UPDATE fnza_detalle_mensualidad SET folio_mens = " & nfolio & " WHERE run_alu = '" & Trim(txt_Rut.Text) & "' AND mes = " & I & " and agno = " & Cmd_agno.Text, Affected
                End If
                RsAux.Close
                'conn.Execute "DELETE FROM fnza_mensualidad WHERE folio_mens = " & Folio & " AND run_apo = '" & Trim(RutOld) & "' and agno = " & Cmd_agno.Text
            Next I
        End If
    End If
    RecalculaCuota_Apo Trim(RutNew), Cmd_agno.Text, conn
    RecalculaCuota_Apo Trim(RutOld), Cmd_agno.Text, conn

End Sub

Private Sub Form_Load()
    Flag_sub = False
    Flag_proc = False
    Dim rs As ADODB.Recordset
    Set rs = New ADODB.Recordset
    Call LlenaCombo(cmb_tip_apo, "tipo_apo", "des_tipo_apo", "", conn)
    Call LlenaCombo(cmb_con_apo, "CONVENIOS", "DES_CONV", "", conn)
    rs.CursorLocation = adUseClient
    rs.Open "SELECT distinct Comuna, Provincia FROM codigos__geograficos ORDER BY COMUNA ASC", conn
    If rs.RecordCount > 0 Then
        Me.cmb_reg_apo.Clear
        Me.cmb_com_apo.Clear
        For t = 0 To rs.RecordCount - 1
            Me.cmb_com_apo.AddItem rs("Comuna")
            Me.cmb_reg_apo.AddItem rs("Provincia")
            rs.MoveNext
        Next t
    End If
    rs.Close
    LimpiaCampos False
    Cmd_agno.Clear
    Flag_sub = True
    Call LlenaCombo(Cmd_agno, "apo_x_alu", "distinct agno", " order by agno desc", conn)
    Cmd_agno.ListIndex = 0
    Flag_sub = False
End Sub

Private Sub Form_Unload(Cancel As Integer)
    If Flag_sub Then Cancel = -1
End Sub



Private Sub guardar_Click()

If ( _
Len(txt_nom_apo) > 1 And Len(TXT_APP_APO) > 1 And Len(txt_apm_apo) > 1 And Len(txt_dir_apo) > 1 And _
Len(cmb_com_apo) > 1 And Len(cmb_reg_apo) > 1 And Len(txt_fon_apo) > 1 And Len(txt_cel_apo) > 1 And _
Len(cmb_niv_apo) > 1 And Len(cmb_par_apo) > 1 And Len(txt_pro_apo) > 1 And Len(txt_emp_apo) > 1 And _
Len(txt_fon_emp_apo) > 1 And Len(cmb_con_apo) > 1 And Len(cmb_tip_apo) > 1 _
) Then

    If MsgBox("¿Está seguro de que desea cambiar el apoderado del alumno " & txt_nombre.Text & vbLf & "Apoderado Atinguo: " & NombreAnt & ", Rut: " & RutOld & vbLf & "Por Nuevo Apoderado : " & txt_nom_apo.Text & " " & TXT_APP_APO.Text & " " & txt_apm_apo.Text & ", Rut : " & txt_rut_apo.Text & "-" & txt_dig_apo.Text & vbLf & "Para el año : " & Cmd_agno.Text & "?", vbQuestion + vbYesNo) = vbYes Then
            cmb_cam_apo.Enabled = False
            lb_advertencia.Caption = ""
            cmb_cam_apo.Refresh
            cmb_Cancelar.Enabled = False
            Flag_proc = True
            cambia_datos
            Flag_proc = False
            cmb_cam_apo.Enabled = True
            cmb_Cancelar.Enabled = True
    End If
    
Else
    MsgBox "Faltan campos por completar"
End If

End Sub

Private Sub list_nombre_Click()
    Dim RC As ADODB.Recordset
    Set RC = New ADODB.Recordset
    
    txt_nombre.Text = list_nombre.Text
    list_nombre.Visible = False
    list_rut.Visible = False
    RC.Open "SELECT ci_alu FROM postulantes WHERE left(CONCAT(ape_Pat_alu,' ',ape_Mat_alu,' ',nom_alu)," & Len(txt_nombre.Text) & ")='" & txt_nombre.Text & "' ORDER BY ape_pat_alu, ape_mat_alu, nom_alu;", conn
    RC.MoveFirst
    Flag_sub = True
    txt_Rut.Text = RC("ci_alu")
    RC.Close
    Flag_sub = False
    txt_nombre.Enabled = False
    txt_Rut.Enabled = False
    Cmd_agno.ListIndex = 0
    Cmd_agno.Enabled = True
    llena_info_adicional
End Sub

Private Sub list_rut_Click()
    Dim RC As ADODB.Recordset
    Set RC = New ADODB.Recordset
    
    txt_Rut.Text = list_rut.Text
    list_nombre.Visible = False
    list_rut.Visible = False
    RC.Open "SELECT CONCAT(ape_pat_alu,' ',ape_mat_alu,' ',nom_alu) as nombre_alu FROM postulantes WHERE ci_alu='" & txt_Rut.Text & "' ORDER BY ci_alu;", conn
    RC.MoveFirst
    Flag_sub = True
    txt_nombre.Text = RC("nombre_alu")
    RC.Close
    Flag_sub = False
    txt_nombre.Enabled = False
    txt_Rut.Enabled = False
    Cmd_agno.ListIndex = 0
    Cmd_agno.Enabled = True
    llena_info_adicional
End Sub


Private Sub txt_dig_apo_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 And Len(Trim(Me.txt_dig_apo.Text)) <> 0 Then
'    If txt_dig_apo.Text = digito(txt_rut_apo.Text) Then
'        Call cmb_par_apo_Click
        Call txt_dig_apo_LostFocus
        'txt_nom_Apo.Enabled = True
        'txt_nom_Apo.SetFocus
'    Else
'        MsgBox "ADVERTENCIA: EL RUT INGRESADO NO ES VALIDO!!", vbOKOnly, "ADVERTENCIA"
'        Me.txt_dig_apo.SetFocus
'        SendKeys "{home}+{end}"
'    End If
ElseIf (Chr(KeyAscii) >= "0" And Chr(KeyAscii) <= "9") Then Exit Sub
ElseIf Chr(KeyAscii) = "K" Or Chr(KeyAscii) = "k" Then Exit Sub
ElseIf KeyAscii = 8 Then Exit Sub
ElseIf KeyAscii = 32 Then Exit Sub
End If
KeyAscii = 0
End Sub

Private Sub txt_dig_apo_LostFocus()
Dim RutApo As String
Dim RsAux As ADODB.Recordset
Set RsAux = New ADODB.Recordset
errorapellidos = 0
If Len(Trim(Me.txt_rut_apo.Text)) > 0 And Len(Trim(Me.txt_rut_apo.Text)) <= 9 Then
    If ValidaRut(txt_rut_apo.Text & "-" & txt_dig_apo.Text) Then
        Me.Frame_apo.Enabled = True
        'If Busqueda = 1 Then 'And Busqueapo = 1 Then
        'If (Me.txt_rut_apo & "-" & Me.txt_dig_apo) <> (Me.txt_rut_alu & "-" & Me.txT_dig_alu) Or ExistReg Then
            If ExistReg("apoderados", "rut_apo = '" & Me.txt_rut_apo & "-" & Me.txt_dig_apo & "'", conn) Then
                'MsgBox ("Apoderado existe en el sistema")
                RsAux.CursorLocation = adUseClient
                RutApo = Me.txt_rut_apo.Text + "-" + Me.txt_dig_apo.Text
                RsAux.Open "SELECT * FROM apoderados where rut_apo = '" & RutApo & "'", conn
                If RsAux.RecordCount > 0 Then
                    Me.txt_nom_apo.Text = RsAux("noms_apo")
                    Me.TXT_APP_APO.Text = RsAux("ape1_apo")
                    Me.txt_apm_apo.Text = RsAux("ape2_apo")
                    Me.txt_dir_apo.Text = RsAux("dir_apo")
                    Me.cmb_com_apo.Text = DevuelveCampo("codigos__geograficos", "", "comuna", "cod_geo = '" & RsAux("comuna_apo") & "'", conn)
                    Me.cmb_reg_apo.Text = DevuelveCampo("codigos__geograficos", "", "provincia", "cod_geo = '" & RsAux("comuna_apo") & "'", conn)
                    Me.txt_fon_apo.Text = RsAux("fon_c_apo")
                    Me.txt_cel_apo.Text = RsAux("cel_apo")
                    'Me.cmb_niv_apo = rsaux("nivel_educ_apo")
                    
                    Select Case RsAux("nivel_educ_apo")
                    
                        Case "Basica Completa"
                            Me.cmb_niv_apo.ListIndex = 0
                            
                        Case "Basica Incompleta"
                            Me.cmb_niv_apo.ListIndex = 1
                            
                        Case "Media Completa"
                            Me.cmb_niv_apo.ListIndex = 2
                            
                        Case "Media Incompleta"
                            Me.cmb_niv_apo.ListIndex = 3
                            
                        Case "Universitarios Completos"
                            Me.cmb_niv_apo.ListIndex = 4
                            
                        Case "Universitarios Incompletos"
                            Me.cmb_niv_apo.ListIndex = 5
                            
                        Case "Tecnico Profesional"
                            Me.cmb_niv_apo.ListIndex = 6
                            
                        Case "Instituto Profesional"
                            Me.cmb_niv_apo.ListIndex = 7
                            
                        Case "Master"
                            Me.cmb_niv_apo.ListIndex = 8
                            
                        Case "Magister"
                            Me.cmb_niv_apo.ListIndex = 9
                            
                        Case "Diplomado"
                            Me.cmb_niv_apo.ListIndex = 10
                            
                    End Select
                    
                    Me.txt_emp_apo.Text = RsAux("empresa")
                    Me.txt_pro_apo.Text = RsAux("profesio_apo")
                    Me.txt_fon_emp_apo.Text = RsAux("empresa_fon")
                    Me.cmb_con_apo.Text = DevuelveCampo("convenios", "", "des_conv", "cod_conv = '" & RsAux("cod_conv") & "'", conn)
                    Me.cmb_tip_apo.Text = DevuelveCampo("tipo_apo", "", "des_tipo_apo", "cod_tipo_apo = '" & RsAux("cod_tipo_apo") & "'", conn)
                    Me.txt_nom_apo.Enabled = True
                    Me.TXT_APP_APO.Enabled = True
                    Me.txt_apm_apo.Enabled = True
                    Me.txt_dir_apo.Enabled = True
                    Me.cmb_com_apo.Enabled = True
                    Me.txt_fon_apo.Enabled = True
                    Me.txt_cel_apo.Enabled = True
                    Me.cmb_niv_apo.Enabled = True
                    Me.cmb_par_apo.Enabled = True
                    Me.txt_pro_apo.Enabled = True
                    Me.txt_emp_apo.Enabled = True
                    Me.txt_fon_emp_apo.Enabled = True
                    Me.cmb_con_apo.Enabled = True
                    Me.cmb_tip_apo.Enabled = True
                    Me.cmb_par_apo = DevuelveCampo("apo_x_alu", "", "parent_apo", "ci_alu ='" & Me.txt_Rut.Text & "' and rut_apo ='" & RutApo & "'", conn)
                    'puse la asignacion de parentesco en esta linea para que el evento click
                    'se ejecute al final de este ciclo.....
                    If errorapellidos = 0 Then
                    Else
                        Me.TXT_APP_APO.Enabled = True
                        Me.TXT_APP_APO.SetFocus
                        SendKeys "{home}+{end}"
                    End If
                    Busqueapo = 0
                    RsAux.Close
                Else
                    RsAux.Close
                End If
            'si encuentra
            Else
                'limpiar los controles de información

                Me.txt_nom_apo.Enabled = True
                Me.TXT_APP_APO.Enabled = False
                Me.txt_apm_apo.Enabled = False
                Me.txt_dir_apo.Enabled = False
                Me.cmb_com_apo.Enabled = False
                Me.txt_fon_apo.Enabled = False
                Me.txt_cel_apo.Enabled = False
                Me.cmb_niv_apo.Enabled = False
                Me.cmb_par_apo.Enabled = False
                Me.txt_pro_apo.Enabled = False
                Me.txt_emp_apo.Enabled = False
                Me.txt_fon_emp_apo.Enabled = False
                Me.cmb_con_apo.Enabled = False
                Me.cmb_tip_apo.Enabled = False
                Me.txt_nom_apo.SetFocus
                
            End If
        'Else
        '    MsgBox ("Rut de apoderado no puede ser igual al del alumno")
        'End If
        Call cmb_par_apo_Click
        txt_nom_apo.Enabled = True
        txt_nom_apo.SetFocus
        Me.txt_rut_apo.Enabled = False: Me.txt_dig_apo.Enabled = False
        Rut_Apo_Ok = True
    
    Else
        Rut_Apo_Ok = False
        MsgBox "ADVERTENCIA: EL RUT INGRESADO NO ES VALIDO!!", vbOKOnly, "ADVERTENCIA"
        Me.txt_rut_apo.SetFocus
        SendKeys "{home}+{end}"
    End If
Else
    Me.txt_rut_apo.SetFocus
End If

End Sub

Private Sub txt_nombre_Change()
    Dim RC As ADODB.Recordset
    
    ' Si el cambio lo hace un Sub no hacer nada
    If Flag_sub Then Exit Sub
    If txt_nombre.Text = "" Then Exit Sub
    Set RC = New ADODB.Recordset
    RC.Open "SELECT DISTINCT a.ape_pat_alu, a.ape_mat_alu, a.nom_alu FROM postulantes a, matriculas m WHERE left(CONCAT(a.ape_pat_alu,' ',a.ape_mat_alu,' ',a.nom_alu)," & Len(txt_nombre.Text) & ")='" & txt_nombre.Text & "' AND a.ci_alu=m.ci_alu ORDER BY a.ape_pat_alu, a.ape_mat_alu, a.nom_alu;", conn
    list_nombre.Clear
    If RC.RecordCount > 0 Then
        While Not (RC.EOF)
            list_nombre.AddItem RC("ape_pat_alu") & " " & RC("ape_mat_alu") & " " & RC("nom_alu")
            RC.MoveNext
        Wend
        list_nombre.Visible = True
        list_rut.Visible = False
    End If
    RC.Close
End Sub

Private Sub txt_nombre_KeyPress(KeyAscii As Integer)
    KeyAscii = Asc(UCase(Chr(KeyAscii)))
End Sub

Private Sub txt_rut_apo_KeyPress(KeyAscii As Integer)
If KeyAscii >= Asc("0") And KeyAscii <= Asc("9") Then Exit Sub
If KeyAscii = 8 Then Exit Sub
If KeyAscii = 32 Then Exit Sub
If KeyAscii = 13 Then
If IsNumeric(txt_rut_apo.Text) And Len(Trim(txt_rut_apo.Text)) > 0 Then
    txt_rut_apo = Format(txt_rut_apo, "00000000")
    Me.txt_dig_apo.Enabled = True
    Me.txt_dig_apo.SetFocus
ElseIf Len(Trim(Me.txt_rut_apo.Text)) >= 1 And Len(Trim(Me.txt_rut_apo.Text)) <= 6 Then
     MsgBox "ADVERTENCIA: EL RUT INGRESADO NO ES VALIDO!!", vbOKOnly, "ADVERTENCIA"
     Me.txt_dig_apo.Text = ""
     txt_rut_apo.Text = ""
     Me.txt_rut_apo.SetFocus
     SendKeys "{home}+{end}"
End If
End If
KeyAscii = 0
End Sub

Private Sub txt_rut_apo_LostFocus()
    Me.txt_rut_apo.Text = Format(Me.txt_rut_apo.Text, "00000000")
End Sub

Private Sub txt_rut_Change()
    Dim RC As ADODB.Recordset
    ' Si el cambio lo hace un Sub no hacer nada
    If Flag_sub Then Exit Sub
    If txt_Rut.Text = "" Then Exit Sub
    Set RC = New ADODB.Recordset
    
    RC.Open "SELECT DISTINCT a.ci_alu FROM postulantes a, matriculas m WHERE left(a.ci_alu," & Len(txt_Rut.Text) & ")='" & txt_Rut.Text & "' AND a.ci_alu=m.ci_alu ORDER BY a.ci_alu;", conn
    list_rut.Clear
    If RC.RecordCount > 0 Then
        While Not (RC.EOF)
            list_rut.AddItem RC("ci_alu")
            RC.MoveNext
        Wend
        list_nombre.Visible = False
        list_rut.Visible = True
    End If
    RC.Close
End Sub

Private Sub llena_info_adicional()
    LimpiaCampos False
    cmb_Cancelar.Enabled = False
    cmb_cam_apo.Enabled = True
    Dim RsAux As ADODB.Recordset
    Set RsAux = New ADODB.Recordset
    RsAux.Open "SELECT * FROM apoderados a, apo_x_alu axu WHERE a.rut_apo = axu.rut_apo and axu.ci_alu = '" & txt_Rut.Text & "' and agno = " & Cmd_agno.Text, conn
    If RsAux.RecordCount = 0 Then MsgBox "El Alumno no tiene matricula para el año seleccionado": cmb_cam_apo.Enabled = False: Exit Sub
    RutOld = RsAux("rut_apo")
    If RsAux("rut_apo") <> "" Then
         Rut_Apo_Ok = True
         Rut_Ini_Apo = RsAux("rut_apo")
         Me.txt_rut_apo.Enabled = False: Me.txt_dig_apo.Enabled = False
         Me.txt_rut_apo.Text = separarut(RsAux("rut_apo"))
         Me.txt_dig_apo.Text = separadigito(RsAux("rut_apo"))
         rutapoderado = Me.txt_rut_apo.Text + "-" + Me.txt_dig_apo
     End If
     Me.txt_nom_apo.Text = RsAux("noms_apo")
     Me.TXT_APP_APO.Text = RsAux("ape1_apo")
     Me.txt_apm_apo.Text = RsAux("ape2_apo")
     Me.txt_dir_apo.Text = RsAux("dir_apo")
     Me.cmb_com_apo.Text = DevuelveCampo("codigos__geograficos", "", "comuna", "cod_geo = '" & RsAux("comuna_apo") & "'", conn)
     Me.cmb_reg_apo.Text = DevuelveCampo("codigos__geograficos", "", "provincia", "cod_geo = '" & RsAux("comuna_apo") & "'", conn)
     
     Me.txt_fon_apo.Text = RsAux("fon_c_apo")
     Me.txt_cel_apo.Text = RsAux("cel_apo")
     
     Me.cmb_niv_apo = RsAux("nivel_educ_apo")
     
     Me.cmb_par_apo = DevuelveCampo("apo_x_alu", "", "parent_apo", "ci_alu ='" & rutalumno & "' and rut_apo ='" & rutapoderado & "'", conn)
     
     Me.txt_emp_apo.Text = RsAux("empresa")
     Me.txt_pro_apo.Text = RsAux("profesio_apo")
     Me.txt_fon_emp_apo.Text = RsAux("empresa_fon")
     Me.cmb_con_apo.Text = DevuelveCampo("convenios", "", "des_conv", "cod_conv = '" & RsAux("cod_conv") & "'", conn)
     Me.cmb_tip_apo.Text = DevuelveCampo("tipo_apo", "", "des_tipo_apo", "cod_tipo_apo = '" & RsAux("cod_tipo_apo") & "'", conn)
     
     'ARRAY DATOS DEL APODERADO
     strDatApo(0) = Me.txt_rut_apo: strDatApo(1) = Me.txt_dig_apo
     strDatApo(2) = Me.txt_nom_apo: strDatApo(3) = Me.TXT_APP_APO
     strDatApo(4) = Me.txt_apm_apo: strDatApo(5) = Me.txt_dir_apo
     strDatApo(6) = Me.cmb_reg_apo: strDatApo(7) = Me.cmb_com_apo
     strDatApo(8) = Me.txt_fon_apo: strDatApo(9) = Me.txt_cel_apo
     strDatApo(10) = Me.cmb_niv_apo: strDatApo(11) = Me.cmb_par_apo
     strDatApo(12) = Me.txt_pro_apo: strDatApo(13) = Me.txt_emp_apo
     strDatApo(14) = Me.txt_fon_emp_apo: strDatApo(15) = Me.cmb_con_apo
     strDatApo(16) = Me.cmb_tip_apo
     cmb_Cancelar.Enabled = False
End Sub

Private Sub LimpiaCampos(Estado As Boolean)
    txt_rut_apo.Text = ""
    txt_dig_apo.Text = ""
    txt_nom_apo.Text = ""
    TXT_APP_APO.Text = ""
    txt_dir_apo.Text = ""
    cmb_com_apo.Text = ""
    txt_fon_apo.Text = ""
    txt_apm_apo.Text = ""
    cmb_reg_apo.Text = ""
    cmb_reg_apo.Text = ""
    txt_cel_apo.Text = ""
    cmb_niv_apo.Text = ""
    txt_pro_apo.Text = ""
    txt_fon_emp_apo.Text = ""
    cmb_par_apo.Text = ""
    txt_emp_apo.Text = ""
    cmb_con_apo.Text = ""
    cmb_tip_apo.Text = ""
    lb_mensaje.Caption = ""
    Estado = False
    
    txt_rut_apo.Enabled = Estado
    txt_dig_apo.Enabled = False
    txt_nom_apo.Enabled = Estado
    TXT_APP_APO.Enabled = Estado
    txt_dir_apo.Enabled = Estado
    cmb_com_apo.Enabled = Estado
    txt_fon_apo.Enabled = Estado
    txt_apm_apo.Enabled = Estado
    cmb_reg_apo.Enabled = Estado
    cmb_reg_apo.Enabled = Estado
    txt_cel_apo.Enabled = Estado
    cmb_niv_apo.Enabled = Estado
    txt_pro_apo.Enabled = Estado
    txt_fon_emp_apo.Enabled = Estado
    cmb_par_apo.Enabled = Estado
    txt_emp_apo.Enabled = Estado
    cmb_con_apo.Enabled = Estado
    cmb_tip_apo.Enabled = Estado
End Sub

Private Sub TXT_APP_APO_KeyPress(KeyAscii As Integer)
KeyAscii = Asc(UCase(Chr(KeyAscii)))
If KeyAscii = 13 And Len(Trim(Me.TXT_APP_APO.Text)) <> 0 Then
    Me.txt_apm_apo.Enabled = True
    txt_apm_apo.SetFocus
Else
    Me.TXT_APP_APO.SetFocus
End If
End Sub

Private Sub txt_cel_apo_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
    Me.cmb_niv_apo.Enabled = True
    Me.cmb_niv_apo.SetFocus
ElseIf (Chr(KeyAscii) >= "0" And Chr(KeyAscii) <= "9") Then Exit Sub
ElseIf KeyAscii = 8 Then Exit Sub
ElseIf KeyAscii = 32 Then Exit Sub
End If
KeyAscii = 0
End Sub

Private Sub txt_nom_apo_KeyPress(KeyAscii As Integer)
KeyAscii = Asc(UCase(Chr(KeyAscii)))
If KeyAscii = 13 And Len(Trim(Me.txt_nom_apo.Text)) <> 0 Then
    Me.TXT_APP_APO.Enabled = True
    TXT_APP_APO.SetFocus
Else
    Me.txt_nom_apo.SetFocus
End If
End Sub

Private Sub txt_apM_apo_KeyPress(KeyAscii As Integer)
KeyAscii = Asc(UCase(Chr(KeyAscii)))
If KeyAscii = 13 And Len(Trim(Me.txt_apm_apo.Text)) <> 0 Then
    Me.txt_dir_apo.Enabled = True
    txt_dir_apo.SetFocus
Else
    Me.txt_apm_apo.SetFocus
End If
End Sub

Private Sub txt_dir_apo_KeyPress(KeyAscii As Integer)
KeyAscii = Asc(UCase(Chr(KeyAscii)))
If KeyAscii = 13 And Len(Trim(Me.txt_dir_apo.Text)) Then
    cmb_com_apo.Enabled = True
    cmb_com_apo.SetFocus
Else
    Me.txt_dir_apo.SetFocus
End If
End Sub

Private Sub cmb_com_apo_Click()
cmb_reg_apo.Visible = True
cmb_reg_apo.ListIndex = Me.cmb_com_apo.ListIndex
End Sub

Private Sub cmb_com_apo_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 And Len(Me.cmb_com_apo.Text) Then
    txt_fon_apo.Enabled = True
    txt_fon_apo.SetFocus
Else
    Me.cmb_com_apo.SetFocus
End If
KeyAscii = 0
End Sub

Private Sub cmb_reg_apo_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
cmb_com_apo.Enabled = True
cmb_com_apo.SetFocus
End If
End Sub

Private Sub txt_fon_apo_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 And Len(Trim(Me.txt_fon_apo.Text)) <> 0 Then
    Me.txt_cel_apo.Enabled = True
    txt_cel_apo.SetFocus
ElseIf (Chr(KeyAscii) >= "0" And Chr(KeyAscii) <= "9") Then Exit Sub
ElseIf KeyAscii = 8 Then Exit Sub
ElseIf KeyAscii = 32 Then Exit Sub
End If
KeyAscii = 0
End Sub

Private Sub cmb_niv_apo_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 And Len(Trim(Me.cmb_niv_apo.Text)) <> 0 Then
    Me.cmb_par_apo.Enabled = True
    cmb_par_apo.SetFocus
Else
    Me.cmb_niv_apo.SetFocus
End If
KeyAscii = 0
End Sub

Private Sub cmb_par_apo_Click()
If Me.cmb_par_apo.Text = "Madre" Then
    If UCase(Trim(DevuelveCampo("postulantes", "", "ape_mat_alu", " ci_alu = '" & txt_Rut.Text & "'", conn))) <> UCase(Trim(Me.TXT_APP_APO.Text)) Then
        If MsgBox("No hay relación de apellidos entre Madre e Hijo" & Chr(13) & chr13 & Chr(13) & "Apellido Madre ->  " & Me.TXT_APP_APO.Text & Chr(13) & "Apellido Hijo     ->  " & DevuelveCampo("postulantes", "", "ape_mat_alu", " ci_alu = '" & txt_Rut.Text & "'", conn) & Chr(13) & Chr(13) & "Corrija el apellido que corresponda" & Chr(13) & "o verifique la opción de parentesco." & Chr(13) & Chr(13) & "¿Desea Corregir?", vbYesNo + vbQuestion) = vbYes Then
            Me.TXT_APP_APO.Enabled = True
            Me.TXT_APP_APO.SetFocus
            errorapellidos = 1
        Else
            errorapellidos = 0
        End If
    End If


ElseIf Me.cmb_par_apo.Text = "Padre" Then
    'aquí limpio la información encontrada en la opción "Madre"
    If UCase(Trim(DevuelveCampo("postulantes", "", "ape_pat_alu", " ci_alu = '" & txt_Rut.Text & "'", conn))) <> UCase(Trim(Me.TXT_APP_APO.Text)) Then
        If MsgBox("No hay relación de apellidos entre Padre e Hijo" & Chr(13) & chr13 & Chr(13) & "Apellido Padre ->  " & Me.TXT_APP_APO.Text & Chr(13) & "Apellido Hijo     ->  " & DevuelveCampo("postulantes", "", "ape_pat_alu", " ci_alu = '" & txt_Rut.Text & "'", conn) & Chr(13) & Chr(13) & "Corrija el apellido que corresponda" & Chr(13) & "o verifique la opción de parentesco." & Chr(13) & Chr(13) & "¿Desea Corregir?", vbYesNo + vbQuestion) = vbYes Then
            Me.TXT_APP_APO.Enabled = True
            Me.TXT_APP_APO.SetFocus
            errorapellidos = 1
        Else
            errorapellidos = 0
        End If
    End If

End If
End Sub

Private Sub cmb_par_apo_KeyPress(KeyAscii As Integer)
If Len(Trim(Me.cmb_par_apo.Text)) <> 0 And KeyAscii = 13 Then
    Me.txt_pro_apo.Enabled = True
    Me.txt_pro_apo.SetFocus
Else
    Me.cmb_par_apo.SetFocus
End If
KeyAscii = 0
End Sub

Private Sub txt_pro_apo_KeyPress(KeyAscii As Integer)
KeyAscii = Asc(UCase(Chr(KeyAscii)))
If KeyAscii = 13 And Len(Trim(Me.txt_pro_apo.Text)) <> 0 Then
    Me.txt_emp_apo.Enabled = True
    Me.txt_emp_apo.SetFocus
End If
End Sub

Private Sub txt_emp_apo_KeyPress(KeyAscii As Integer)
KeyAscii = Asc(UCase(Chr(KeyAscii)))
If KeyAscii = 13 Then
    Me.txt_fon_apo.Enabled = True
    Me.txt_fon_emp_apo.Enabled = True
    txt_fon_emp_apo.SetFocus
End If
End Sub

Private Sub txt_fon_emp_apo_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
    Me.cmb_con_apo.Enabled = True
    cmb_con_apo.SetFocus
ElseIf (Chr(KeyAscii) >= "0" And Chr(KeyAscii) <= "9") Then Exit Sub
ElseIf KeyAscii = 8 Then Exit Sub
ElseIf KeyAscii = 32 Then Exit Sub
End If
KeyAscii = 0
End Sub

Private Sub cmb_con_apo_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 And Len(Me.cmb_con_apo.Text) <> 0 Then
Else
    Me.cmb_con_apo.SetFocus
End If
KeyAscii = 0
End Sub

Private Sub cmb_tip_apo_KeyPress(KeyAscii As Integer)
If Not (KeyAscii = 13 And Len(Me.cmb_tip_apo.Text) <> 0) Then
    Me.cmb_tip_apo.SetFocus
End If
KeyAscii = 0
End Sub

Private Sub genera_log(accion As Variant)
    Sql = "CREATE TABLE IF NOT EXISTS `cambioapoderado_log`(`id` bigint(20) NOT NULL auto_increment,`LOGIN_USUARIO` varchar(100) NOT NULL default '',`NOMBRE_USUARIO` varchar(100) NOT NULL default '',`agno` int(11) NOT NULL default '0',`ACCION` text NOT NULL default '',`FECHA_MODIFICACION` datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY  (`id`),UNIQUE KEY `cambioapoderado_log_sec_key` (`FECHA_MODIFICACION`,`LOGIN_USUARIO`)) ENGINE=MyISAM;"
    conn.Execute Sql
    Sql = "INSERT INTO cambioapoderado_log (LOGIN_USUARIO,NOMBRE_USUARIO,AGNO,FECHA_MODIFICACION,ACCION) values ('" & Nom_usu_ses & "','" & Nom_com_usu_ses & "',year(current_date),concat(current_date,' ',current_time),'" & Replace(accion, "'", "\'") & "')"
    conn.Execute Sql
End Sub
