VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form frm_cam_cur 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Cambio de Curso"
   ClientHeight    =   7215
   ClientLeft      =   300
   ClientTop       =   1710
   ClientWidth     =   7470
   Icon            =   "frm_cambio_curso.frx":0000
   LinkTopic       =   "Form3"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   Moveable        =   0   'False
   ScaleHeight     =   7215
   ScaleWidth      =   7470
   Begin VB.Frame Frame_grilla 
      Height          =   3255
      Left            =   120
      TabIndex        =   18
      Top             =   3840
      Width           =   7215
      Begin MSFlexGridLib.MSFlexGrid Grd_cambiocurso 
         Height          =   2895
         Left            =   120
         TabIndex        =   19
         Top             =   240
         Width           =   6975
         _ExtentX        =   12303
         _ExtentY        =   5106
         _Version        =   393216
         AllowUserResizing=   1
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
      End
   End
   Begin VB.Frame fra_cam_cur 
      Caption         =   "Cambio de Curso"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C00000&
      Height          =   3615
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   7215
      Begin VB.ComboBox cmb_agno 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   330
         Left            =   1680
         TabIndex        =   20
         Top             =   360
         Width           =   3255
      End
      Begin VB.CheckBox chk_busqaprox_camcur 
         Caption         =   "Buscar por frase"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   5400
         TabIndex        =   2
         Top             =   750
         Width           =   1575
      End
      Begin VB.CommandButton btn_otroalumno 
         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          =   375
         Left            =   4800
         TabIndex        =   10
         Top             =   3120
         Width           =   1095
      End
      Begin VB.CommandButton btn_can_cur 
         Caption         =   "Cancelar"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   6000
         TabIndex        =   11
         Top             =   3120
         Width           =   1095
      End
      Begin VB.CommandButton btn_ace_cur 
         Caption         =   "Aceptar"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   3600
         TabIndex        =   9
         Top             =   3120
         Width           =   1095
      End
      Begin VB.TextBox txt_dig_cur 
         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
         TabIndex        =   4
         Text            =   " "
         Top             =   1080
         Width           =   255
      End
      Begin VB.TextBox txt_ape_cur 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   1680
         TabIndex        =   1
         Top             =   720
         Width           =   3255
      End
      Begin VB.TextBox txt_rut_cur 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   1680
         TabIndex        =   3
         Text            =   " "
         Top             =   1080
         Width           =   855
      End
      Begin VB.ComboBox cmb_nue_cur 
         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
         Left            =   1680
         TabIndex        =   7
         Top             =   2160
         Width           =   3255
      End
      Begin VB.TextBox txt_mod_alu 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   1680
         TabIndex        =   5
         Text            =   " "
         Top             =   1440
         Width           =   3255
      End
      Begin VB.TextBox txt_cur_alu 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   1680
         TabIndex        =   6
         Text            =   " "
         Top             =   1800
         Width           =   3255
      End
      Begin MSComCtl2.DTPicker dtp_fec_cur 
         BeginProperty DataFormat 
            Type            =   1
            Format          =   "dd/MM/yyyy"
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2058
            SubFormatType   =   3
         EndProperty
         Height          =   375
         Left            =   1680
         TabIndex        =   8
         Top             =   2520
         Width           =   3255
         _ExtentX        =   5741
         _ExtentY        =   661
         _Version        =   393216
         Enabled         =   0   'False
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         CustomFormat    =   "dd/mm/yyyy"
         Format          =   146604033
         CurrentDate     =   40544
         MaxDate         =   73415
         MinDate         =   37622
      End
      Begin VB.Label Label2 
         Caption         =   "Año de Trabajo"
         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        =   21
         Top             =   360
         Width           =   1095
      End
      Begin VB.Label lbl_fec_cur 
         Caption         =   "Fecha de Cambio"
         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        =   17
         Top             =   2550
         Width           =   1335
      End
      Begin VB.Label lbl_nue_cur 
         Caption         =   "Nuevo Curso"
         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        =   16
         Top             =   2160
         Width           =   1095
      End
      Begin VB.Label lbl_cur_cur 
         Caption         =   "Curso"
         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        =   15
         Top             =   1800
         Width           =   615
      End
      Begin VB.Label lbl_mod_cur 
         Caption         =   "Modalidad"
         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        =   14
         Top             =   1440
         Width           =   855
      End
      Begin VB.Label lbl_ape_curt 
         Caption         =   "Apellido"
         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        =   13
         Top             =   720
         Width           =   735
      End
      Begin VB.Label lbl_rut_cur 
         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            =   240
         TabIndex        =   12
         Top             =   1080
         Width           =   855
      End
   End
End
Attribute VB_Name = "frm_cam_cur"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Sub btn_ace_cur_Click()
'On Error GoTo CONTROLError
Dim log As Boolean
Dim curso, curso_ant, grado2, accion_realizada As String
Dim FechaCambio As Date
Dim FechaMatri As Date
Dim FechaAlta As Date
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset

fila = Me.Grd_cambiocurso.Row
If Len(Trim(Me.cmb_nue_cur.Text)) <> 0 And Len(Trim(Me.dtp_fec_cur.Value)) <> 0 Then
    grado = arraygrilla(fila, 5)
    Letra = arraygrilla(fila, 6)
    modalidad = arraygrilla(fila, 7)
    FechaMatri = arraygrilla(fila, 8)
    junaeb = arraygrilla(fila, 9)
    chisol = arraygrilla(fila, 10)
    integral = arraygrilla(fila, 11)
    diferencial = arraygrilla(fila, 12)
    Repitente = arraygrilla(fila, 13)
    cialu = arraygrilla(fila, 1)
    newgrado = Anuevocurso(Me.cmb_nue_cur.ListIndex, 1)
    newletra = Anuevocurso(Me.cmb_nue_cur.ListIndex, 2)
    FechaCambio = Format(Me.dtp_fec_cur.Value, "dd/mm/yyyy")
    desmodalidad = devuelvecampo("codigos_ensenanza", "", "des_ens", "cod_ens ='" & modalidad & "'", conn)
    FechaAlta = CDate(RetornaCampo("alu_x_cur", "fec_alta", "ci_alu='" & cialu & "' AND agno=" & Trim(Cmb_Agno.Text) & " and fec_mat='" & Format(FechaMatri, "yyyy-mm-dd") & "' AND activo_alu='SI'", conn))
    
    If Not ExistReg("alu_x_cur", "ci_alu = '" & cialu & "' and cod_ens = '" & modalidad & "' and num_gra = '" & grado & "' and let_cur = '" & Letra & "' and fec_cam = '" & InvierteFecha(FechaCambio, "R") & "' and fec_mat = '" & InvierteFecha(FechaMatri, "R") & "' and activo_alu = 'NO' and agno = " & Cmb_Agno.Text, conn) Then
        
        ncambio = GeneraCod("alu_x_cur", "num_cam", "ci_alu = '" & cialu & "' and cod_ens = '" & modalidad & "' and num_gra_new = '" & grado & "' and let_cur_new = '" & Letra & "' and activo_alu = 'NO' and agno = " & Cmb_Agno.Text, 2, conn)
        strsql = "UPDATE alu_x_cur Set activo_alu = 'NO', fec_cam = '" & Format(FechaCambio, "yyyy-mm-dd") & "', num_gra_new = " & "'" & newgrado & "', let_cur_new = '" & newletra & "', num_cam = '" & ncambio & "' where ci_alu = '" & cialu & "' and cod_ens = '" & modalidad & "' and num_gra = '" & grado & "'and let_cur = '" & Letra & "' and activo_alu = 'SI' and agno = " & Cmb_Agno.Text
        conn.Execute strsql
        strsql = "INSERT INTO alu_x_cur(cod_ens, num_gra, let_cur, ci_alu, fec_mat, fec_cam, activo_alu, ind_ben_junaeb, ind_ben_chi_sol, ind_alu_int, ind_gru_dif, ind_rep, fec_ing_curso, agno, fec_alta,cambio) values('" & modalidad & "','" & newgrado & "','" & newletra & "','" & cialu & "','" & Format(FechaMatri, "yyyy-mm-dd") & "','1111-11-11', 'SI', '" & junaeb & "' , '" & chisol & "' , '" & integral & "' , '" & diferencial & "' , '" & Repitente & "','" & Format(FechaCambio, "yyyy-mm-dd") & "'," & Cmb_Agno.Text & ",'" & Format(FechaAlta, "yyyy-mm-dd") & "','SI')"
        conn.Execute strsql
        If ExistReg("asistencia", "ci_alu = '" & cialu & "' and cod_ens = '" & modalidad & "' and num_gra = '" & grado & "' and let_cur = '" & Letra & "' and fec_mat = '" & Format(FechaMatri, "yyyy-mm-dd") & "' and agno = " & Cmb_Agno.Text, conn) Then
            conn.Execute "UPDATE asistencia Set activo_alu = 'NO' where ci_alu = '" & cialu & "' and cod_ens = '" & modalidad & "' and num_gra = '" & grado & "'and let_cur = '" & Letra & "' and activo_alu = 'SI' and fec_mat = '" & Format(FechaMatri, "yyyy-mm-dd") & "' and agno = " & Cmb_Agno.Text
        End If
        rs.CursorLocation = adUseClient
        rs.Open "select * from notas where ci_alu ='" & cialu & "' and agno = " & Cmb_Agno.Text, conn
        If rs.RecordCount > 0 Then
            While Not rs.EOF
                Codsector = rs("cod_sec")
                Codasig = rs("cod_asi")
                nperiodo = rs("num_per")
                codeva = rs("cod_eva")
                Nota = rs("nota")
                conn.Execute "insert into notas (cod_ens, num_gra, letra_curso, cod_sec, cod_asi, ci_alu, num_per, cod_eva, nota,agno) values('" & modalidad & "','" & newgrado & "','" & newletra & "','" & Codsector & "','" & Codasig & "','" & cialu & "','" & nperiodo & "','" & codeva & "','" & Nota & "'," & Cmb_Agno.Text & ")"
                conn.Execute "delete from notas where ci_alu ='" & cialu & "' and cod_ens ='" & modalidad & " ' and num_gra ='" & grado & "' and letra_curso ='" & Letra & "' and cod_sec ='" & Codsector & "' and cod_asi='" & Codasig & "' and num_per ='" & nperiodo & "' and cod_eva ='" & codeva & "' and agno = " & Cmb_Agno.Text
                rs.MoveNext
            Wend
        End If
        rs.Close
        
        'Insertar log
        Select Case modalidad
            Case "996"
                grado2 = "PK"
            Case "010"
                grado2 = "K"
            Case "110"
                grado2 = "EB"
            Case "310"
                grado2 = "EM"
        End Select
        curso_ant = grado & "º " & Letra & " " & grado2
        curso = newgrado & "º " & newletra & " " & grado2
        accion_realizada = "Se realizo un cambio de curso, desde " & curso_ant _
                         & " al " & curso
        log = Inserta_Vitacora_Alumno(CStr(cialu), accion_realizada)
        'Fin de log
        
        MsgBox ("Cambio de curso realizado con éxito" & Chr(13) & Chr(13) & "Curso anterior : " & grado & " " & Letra & " " & desmodalidad & Chr(13) & "Curso nuevo    : " & newgrado & " " & newletra & " " & desmodalidad)
        Call btn_otroalumno_Click
    Else
        MsgBox ("No es puede volver al mismo curso dos veces mismo día" & Chr(13) & "En lo posible, corrija la fecha de cambio.")
    End If
Else
    MsgBox ("Faltan campos importantes por llenar")
    Me.cmb_nue_cur.Enabled = True
    Me.cmb_nue_cur.SetFocus
    Exit Sub
End If
Exit Sub
Controlerror:
    MsgBox Err.Description & vbCrLf & vbCrLf & Err.Source, vbExclamation, Err.Number
End Sub

Private Sub btn_can_cur_Click()
Unload Me
End Sub

Private Sub btn_otroalumno_Click()
Me.txt_ape_cur.Text = ""
Me.txt_rut_cur.Text = ""
Me.txt_dig_cur.Text = ""
Me.txt_mod_alu.Text = ""
Me.txt_cur_alu.Text = ""
Me.cmb_nue_cur.Clear
Me.txt_ape_cur.Enabled = True
Me.cmb_nue_cur = ""
Me.cmb_nue_cur.Enabled = False

Me.dtp_fec_cur.MinDate = Date
Me.dtp_fec_cur.Value = Date
Me.dtp_fec_cur.Enabled = False

Me.Btn_Ace_cur.Enabled = False
Me.btn_otroalumno.Enabled = False
Me.txt_ape_cur.SetFocus
Me.Grd_cambiocurso.Clear
Me.Grd_cambiocurso.FormatString = "R.U.N          |Apellido Paterno  |Apellido Materno  |Nombres                              |Nivel |Letra"
Me.Grd_cambiocurso.Rows = 2
Busqueda = 1
End Sub

Private Sub chk_busq_aprox_Click()
Me.txt_ape_cur.SetFocus
End Sub

Private Sub chk_busqaprox_camcur_Click()
Me.txt_ape_cur.SetFocus
End Sub

Private Sub Cmb_Agno_Click()
    txt_ape_cur_Change
End Sub

Private Sub cmb_nue_cur_Click()
    'Dar Restricciones
    dtp_fec_cur.MinDate = CDate(RetornaCampo("alu_x_cur", "fec_ing_curso", "agno='" & Trim(Cmb_Agno.Text) & "' AND activo_alu='SI' AND ci_alu='" & Trim(txt_rut_cur.Text) & "-" & Trim(txt_dig_cur.Text) & "'", conn))
    dtp_fec_cur.Enabled = True
    '
End Sub

Private Sub cmb_nue_cur_KeyPress(KeyAscii As Integer)
KeyAscii = 0
End Sub

Private Sub Form_Activate()
    txt_ape_cur.SetFocus
End Sub

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

Private Sub Form_Load()
    frm_cam_cur.KeyPreview = True
    Busqueda = 1
    CentrarForma Me
    frm_cam_cur.Show
    Me.Grd_cambiocurso.FixedRows = 1
    Me.Grd_cambiocurso.FixedCols = 0
    Me.Grd_cambiocurso.FormatString = "R.U.N          |Apellido Paterno  |Apellido Materno  |Nombres                              |Nivel |Letra"
    Me.txt_rut_cur.Enabled = False
    Me.txt_dig_cur.Enabled = False
    Me.cmb_nue_cur.Enabled = False
    Me.txt_mod_alu.Enabled = False
    Me.txt_cur_alu.Enabled = False
    '
    Me.dtp_fec_cur.Value = Date
    '
    Me.dtp_fec_cur.Enabled = False
    Me.Btn_Ace_cur.Enabled = False
    Me.btn_otroalumno.Enabled = False
    Cmb_Agno.AddItem Anno
    Cmb_Agno.AddItem Anno + 1
    Cmb_Agno.Text = Anno
End Sub





Private Sub Grd_cambiocurso_DblClick()
Dim rut, cialu As String
If Me.Grd_cambiocurso.TextMatrix(1, 0) <> "" Then
    fila = Me.Grd_cambiocurso.Row
    Indi = 0
    Busqueda = 0
    cialu = arraygrilla(fila, 1)
    nombre = arraygrilla(fila, 2) + " " + arraygrilla(fila, 3) + " " + arraygrilla(fila, 4)
    grado = arraygrilla(fila, 5)
    Letra = arraygrilla(fila, 6)
    modalidad = arraygrilla(fila, 7)
    Me.txt_ape_cur.Text = nombre
    Me.txt_rut_cur.Text = separarut(cialu)
    Me.txt_dig_cur.Text = separadigito(cialu)
    Me.txt_mod_alu.Text = devuelvecampo("codigos_ensenanza", "cod_ens", "des_ens", "cod_ens = '" & modalidad & "'", conn)
    Me.txt_cur_alu.Text = grado + " " + Letra
    Me.txt_ape_cur.Enabled = False
    Me.txt_rut_cur.Enabled = False
    Me.txt_dig_cur.Enabled = False
    Me.txt_mod_alu.Enabled = False
    Me.txt_cur_alu.Enabled = False
    Me.cmb_nue_cur.Enabled = True
    Me.cmb_nue_cur.SetFocus
    Me.Btn_Ace_cur.Enabled = True
    Me.btn_otroalumno.Enabled = True
End If
End Sub

Private Sub LST_NOM_CUR_DblClick()
Dim rut, cialu As String
Indi = 0
Busqueda = 0
cialu = arraygrilla(fila, 0)
nombre = arraygrilla(fila, 1) + " " + arraygrilla(fila, 2) + " " + arraygrilla(fila, 3)
modalidad = arraygrilla(fila, 4)
grado = arraygrilla(fila, 5)
Letra = arraygrilla(fila, 6)
Me.txt_ape_cur.Text = nombre
Me.txt_rut_cur.Text = separarut(cialu)
Me.txt_dig_cur.Text = separadigito(cialu)
Me.txt_mod_alu.Text = devuelvecampo("codigos_ensenanza", "cod_ens", "des_ens", "cod_ens = '" & modalidad & "'", conn)
Me.txt_cur_alu.Text = grado + " " + Letra
LST_NOM_CUR.Visible = False
Me.txt_ape_cur.Enabled = False
Me.txt_rut_cur.Enabled = False
Me.txt_dig_cur.Enabled = False
Me.txt_mod_alu.Enabled = False
Me.txt_cur_alu.Enabled = False
Me.cmb_nue_cur.Enabled = True
Me.cmb_nue_cur.SetFocus
Me.Btn_Ace_cur.Enabled = True
Me.btn_otroalumno.Enabled = True
End Sub

Private Sub LST_NOM_CUR_GotFocus()
Me.btn_otroalumno.Enabled = False
Me.Btn_Ace_cur.Enabled = False
End Sub

Private Sub lbl_mem_Click()

End Sub

Private Sub txt_ape_cur_Change()
If Busqueda = 1 And Len(Trim(Me.txt_ape_cur.Text)) > 0 And Me.chk_busqaprox_camcur.Value = 0 Then
    Criterio = "'" + Me.txt_ape_cur.Text + "%'"
    Call LlenaGrilla(Grd_cambiocurso, "R.U.N          ,Apellido Paterno  ,Apellido Materno  ,Nombres                              ,Nivel ,Letra", "postulantes, alu_x_cur", "postulantes.ci_alu; postulantes.ape_pat_alu; postulantes.ape_mat_alu; postulantes.nom_alu; alu_x_cur.Num_Gra; alu_x_cur.let_cur; alu_x_cur.cod_ens; alu_x_cur.fec_mat; alu_x_cur.ind_ben_junaeb; alu_x_cur.ind_ben_chi_sol; alu_x_cur.ind_alu_int; alu_x_cur.ind_gru_dif; alu_x_cur.ind_rep ", "alu_x_cur.activo_alu ='SI' and alu_x_cur.ci_alu = postulantes.ci_alu and alu_x_cur.agno = " & Cmb_Agno.Text & " and postulantes.ape_pat_alu like " & Criterio & "order by ape_pat_alu, ape_mat_alu, nom_alu", conn)
ElseIf Busqueda = 1 And Len(Trim(Me.txt_ape_cur.Text)) = 0 Then
     Me.Grd_cambiocurso.Clear
     Me.Grd_cambiocurso.FormatString = "R.U.N          |Apellido Paterno  |Apellido Materno  |Nombres                              |Nivel |Letra"
     Me.Grd_cambiocurso.Rows = 2
End If
End Sub

Private Sub txt_ape_cur_KeyPress(KeyAscii As Integer)
If Len(Trim(Me.txt_ape_cur.Text)) <> 0 And KeyAscii = 13 Then
    If Busqueda = 1 And Len(Trim(Me.txt_ape_cur.Text)) > 0 And Me.chk_busqaprox_camcur.Value = 1 Then
        Criterio = "'" + Me.txt_ape_cur.Text + "%'"
    Call LlenaGrilla(Grd_cambiocurso, "R.U.N          ,Apellido Paterno  ,Apellido Materno  ,Nombres                              ,Nivel ,Letra", "postulantes, alu_x_cur", "postulantes.ci_alu; postulantes.ape_pat_alu; postulantes.ape_mat_alu; postulantes.nom_alu; alu_x_cur.Num_Gra; alu_x_cur.let_cur; alu_x_cur.cod_ens; alu_x_cur.fec_mat; alu_x_cur.ind_ben_junaeb; alu_x_cur.ind_ben_chi_sol; alu_x_cur.ind_alu_int; alu_x_cur.ind_gru_dif; alu_x_cur.ind_rep ", "alu_x_cur.activo_alu ='SI' and alu_x_cur.ci_alu = postulantes.ci_alu and alu_x_cur.agno = " & Cmb_Agno.Text & " and postulantes.ape_pat_alu like " & Criterio & "order by ape_pat_alu, ape_mat_alu, nom_alu", conn)
    ElseIf Busqueda = 1 And Len(Trim(Me.txt_ape_cur.Text)) = 0 Then
        Me.Grd_cambiocurso.Clear
        Me.Grd_cambiocurso.FormatString = "R.U.N          |Apellido Paterno  |Apellido Materno  |Nombres                              |Nivel |Letra"
        Me.Grd_cambiocurso.Rows = 2
    End If
End If
End Sub

Private Sub txt_rut_cur_Change()
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset

fila = Me.Grd_cambiocurso.Row
grado = arraygrilla(fila, 5)
Letra = arraygrilla(fila, 6)
modalidad = arraygrilla(fila, 7)
rs.CursorLocation = adUseClient
rs.Open "SELECT * FROM CURSOS where cod_ens ='" & modalidad & "'and num_gra ='" & grado & "' and let_cur <> '" & Letra & "' and agno = " & Cmb_Agno.Text & " ORDER BY NUM_GRA,let_cur", conn
If rs.RecordCount > 0 Then
ReDim Anuevocurso(rs.RecordCount, 2)
Me.cmb_nue_cur.Clear
c = 0
While Not rs.EOF
   cmb_nue_cur.AddItem rs("num_gra") + " " + rs("LET_CUR")
   Anuevocurso(c, 1) = rs("num_gra")
   Anuevocurso(c, 2) = rs("let_cur")
   rs.MoveNext
   c = c + 1
Wend
Me.btn_otroalumno.Enabled = True
Me.Btn_Ace_cur.Enabled = True
End If
rs.Close

End Sub
