VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form FORM_PAR_GLO 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Creación de Colegio"
   ClientHeight    =   5670
   ClientLeft      =   45
   ClientTop       =   375
   ClientWidth     =   10005
   DrawMode        =   14  'Copy Pen
   Icon            =   "FORM_PAR_GLO.frx":0000
   LinkTopic       =   "Form3"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   Moveable        =   0   'False
   ScaleHeight     =   5670
   ScaleWidth      =   10005
   Begin VB.Frame frame_par_glo 
      Caption         =   "Creación de Establecimiento"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C00000&
      Height          =   5415
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   9735
      Begin VB.Frame Frame2 
         Caption         =   "Otros Datos"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00C00000&
         Height          =   2415
         Left            =   120
         TabIndex        =   2
         Top             =   2880
         Width           =   9495
         Begin VB.CommandButton btn_can_est 
            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            =   8160
            TabIndex        =   33
            Top             =   1920
            Width           =   1215
         End
         Begin VB.CommandButton btn_eli_est 
            Caption         =   "Eliminar"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   375
            Left            =   6840
            TabIndex        =   32
            Top             =   1920
            Width           =   1215
         End
         Begin VB.CommandButton btn_ace_est 
            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            =   5520
            TabIndex        =   17
            Top             =   1920
            Width           =   1215
         End
         Begin MSComCtl2.DTPicker dtp_fec_est 
            BeginProperty DataFormat 
               Type            =   1
               Format          =   "MM/dd/yyyy"
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   2058
               SubFormatType   =   3
            EndProperty
            Height          =   375
            Left            =   3000
            TabIndex        =   16
            Top             =   1560
            Width           =   1335
            _ExtentX        =   2355
            _ExtentY        =   661
            _Version        =   393216
            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
            Format          =   99549185
            CurrentDate     =   37666
         End
         Begin VB.TextBox txt_dig_rut_est 
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   285
            Left            =   8400
            TabIndex        =   31
            Top             =   480
            Width           =   255
         End
         Begin VB.TextBox txt_apm_est 
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   285
            Left            =   7320
            TabIndex        =   14
            Top             =   840
            Width           =   1935
         End
         Begin VB.TextBox txt_rut_est 
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   285
            Left            =   7320
            MaxLength       =   7
            TabIndex        =   12
            Top             =   480
            Width           =   975
         End
         Begin VB.TextBox txt_app_est 
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   285
            Left            =   3000
            TabIndex        =   13
            Top             =   840
            Width           =   2055
         End
         Begin VB.TextBox txt_nom_dir_est 
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   285
            Left            =   3000
            TabIndex        =   11
            Top             =   480
            Width           =   2055
         End
         Begin VB.TextBox txt_num_est 
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   285
            Left            =   3000
            MaxLength       =   8
            TabIndex        =   15
            Top             =   1200
            Width           =   1335
         End
         Begin VB.Label lbl_rut_est 
            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            =   5640
            TabIndex        =   30
            Top             =   480
            Width           =   1455
         End
         Begin VB.Label lbl_apm_est 
            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            =   5640
            TabIndex        =   29
            Top             =   840
            Width           =   1575
         End
         Begin VB.Label lbl_num_est 
            Caption         =   "Nº Resolución De R. Oficial"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   375
            Left            =   240
            TabIndex        =   28
            Top             =   1200
            Width           =   2895
         End
         Begin VB.Label lbl_fec_est 
            Caption         =   "Fecha de Resolucion de R. Oficial"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   375
            Left            =   240
            TabIndex        =   27
            Top             =   1560
            Width           =   2655
         End
         Begin VB.Label lbl_app_est 
            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        =   26
            Top             =   840
            Width           =   1695
         End
         Begin VB.Label LBL_NOM_EST 
            Caption         =   "Nombre del Director"
            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        =   25
            Top             =   480
            Width           =   1935
         End
      End
      Begin VB.Frame FRAME1 
         Caption         =   "Datos Del Establecimiento"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00C00000&
         Height          =   2415
         Left            =   120
         TabIndex        =   1
         Top             =   360
         Width           =   9495
         Begin VB.ListBox lst_nom_est 
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   1110
            Left            =   2640
            TabIndex        =   34
            Top             =   840
            Visible         =   0   'False
            Width           =   3975
         End
         Begin VB.TextBox txt_cor_est 
            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        =   9
            Top             =   1680
            Width           =   2055
         End
         Begin VB.TextBox txt_tel_est 
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   285
            Left            =   6360
            MaxLength       =   7
            TabIndex        =   8
            Top             =   1320
            Width           =   2895
         End
         Begin VB.TextBox txt_dir_est 
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   285
            Left            =   6360
            TabIndex        =   6
            Top             =   960
            Width           =   2895
         End
         Begin VB.TextBox txt_loc_est 
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   285
            Left            =   6360
            TabIndex        =   10
            Top             =   1680
            Width           =   2895
         End
         Begin VB.TextBox txt_cel_est 
            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       =   9
            TabIndex        =   7
            Top             =   1320
            Width           =   1095
         End
         Begin VB.TextBox txt_nom_est_est 
            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        =   5
            Top             =   600
            Width           =   3975
         End
         Begin VB.TextBox txt_rbd_est 
            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       =   7
            TabIndex        =   3
            Top             =   960
            Width           =   735
         End
         Begin VB.TextBox txt_rbd_dig_est 
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   285
            Left            =   3480
            LinkTimeout     =   1
            MaxLength       =   1
            TabIndex        =   4
            Top             =   960
            Width           =   255
         End
         Begin VB.Label Label12 
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Left            =   3720
            TabIndex        =   35
            Top             =   120
            Width           =   5655
         End
         Begin VB.Label lbl_est_glo 
            Caption         =   "RBD"
            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        =   24
            Top             =   960
            Width           =   735
         End
         Begin VB.Label nom_est_glo 
            Caption         =   "Nombre Establecimiento"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   375
            Left            =   240
            TabIndex        =   23
            Top             =   600
            Width           =   2415
         End
         Begin VB.Label dir_est_glo 
            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            =   5280
            TabIndex        =   22
            Top             =   960
            Width           =   1095
         End
         Begin VB.Label tel_est_glo 
            Caption         =   "Telefono"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Left            =   5280
            TabIndex        =   21
            Top             =   1320
            Width           =   975
         End
         Begin VB.Label lbl_cel_glo 
            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            =   240
            TabIndex        =   20
            Top             =   1320
            Width           =   2175
         End
         Begin VB.Label LBL_COR_EST 
            Caption         =   "Correo Eléctronico"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   375
            Left            =   240
            TabIndex        =   19
            Top             =   1680
            Width           =   1695
         End
         Begin VB.Label lbl_loc_est 
            Caption         =   "Localidad "
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   375
            Left            =   5280
            TabIndex        =   18
            Top             =   1680
            Width           =   2295
         End
      End
   End
End
Attribute VB_Name = "FORM_PAR_GLO"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub btn_ace_est_Click()

If Me.txt_nom_est_est.Text <> "" And Me.txt_rbd_est.Text <> "" And IsNumeric(Me.txt_rbd_est.Text) _
And Me.txt_rbd_dig_est.Text <> "" And IsNumeric(Me.txt_rbd_dig_est.Text) And Me.txt_dir_est.Text <> "" _
And Me.txt_dir_est.Text <> "" And Me.txt_cel_est.Text <> "" _
And Me.txt_tel_est.Text <> "" And IsNumeric(Me.txt_tel_est.Text) And Me.txt_cor_est.Text <> "" _
And Me.txt_loc_est.Text <> "" And Me.txt_nom_dir_est.Text <> "" And Me.txt_rut_est.Text <> "" _
And Me.txt_app_est.Text <> "" And Me.txt_apm_est.Text <> "" And Me.txt_num_est.Text <> "" _
And Me.txt_dig_rut_est.Text <> "" _
Then

    txt_rbd = Me.txt_rbd_est.Text + "-" + Me.txt_rbd_dig_est.Text
    
    a = "SELECT * FROM establecimientos"
    rs.CursorLocation = adUseClient
    rs.Open a, conn

    While Not rs.EOF
        If rs("rdb") = txt_rbd Then
            MsgBox ("RDB duplicado. El registro no será guardado.")
            rs.Close
            Exit Sub
        End If
        rs.MoveNext
    Wend
    
    rs.Close
    
    txt_run_est = txt_rut_est + "-" + txt_dig_rut_est
    
    If MsgBox("El registro no existe. ¿Desea crearlo?", vbYesNo + vbQuestion) = vbYes Then
            conn.Execute "INSERT INTO ESTABLECIMIENTOS(" & _
           "NOM_EST,RDB,NUM_PRE_ST,DIR_EST,CEL_EST,FON_EST,MAIL_EST,LOCALIDAD_EST,NOM_DIR,RUT_DIRECTOR_EST,APE_PAT_DIR,APE_MAT_DIR,NUM_RES_REC_OFI_EST,FEC_RES_REC_OFI_EST) " & _
            "values(" & _
            "'" & txt_nom_est_est & "', " & _
            "'" & txt_rbd & "', " & _
            "'" & txt_rbd_dig_est & "', " & _
            "'" & txt_dir_est & "', " & _
            "'" & txt_cel_est & "', " & _
            "'" & txt_tel_est & "', " & _
            "'" & txt_cor_est & "', " & _
            "'" & txt_loc_est & "', " & _
            "'" & txt_nom_dir_est & "', " & _
            "'" & txt_run_est & "', " & _
            "'" & txt_app_est & "', " & _
            "'" & txt_apm_est & "', " & _
            "'" & txt_num_est & "', " & _
            "'" & dtp_fec_est & "')"
            
            Me.txt_nom_est_est.Text = ""
            Me.txt_rbd_est.Text = ""
            Me.txt_rbd_dig_est.Text = ""
            Me.txt_dir_est.Text = ""
            Me.txt_cel_est.Text = ""
            Me.txt_tel_est.Text = ""
            Me.txt_cor_est.Text = ""
            Me.txt_loc_est.Text = ""
            Me.txt_nom_dir_est.Text = ""
            Me.txt_rut_est.Text = ""
            Me.txt_app_est.Text = ""
            Me.txt_apm_est.Text = ""
            Me.txt_num_est.Text = ""
            Me.txt_dig_rut_est.Text = ""
    End If
Else
    MsgBox ("Formulario con datos erroneos o incompletos.")
End If
End Sub

Private Sub btn_can_est_Click()
Unload Me
End Sub

Private Sub btn_eli_est_Click()
If MsgBox("El registro  será eliminado. ¿Desea continuar?", vbYesNo + vbQuestion) = vbYes Then
            conn.Execute "DELETE FROM ESTABLECIMIENTOS WHERE RDB ='" & txt_rbd_est & "'"
            Me.txt_rbd_est.Text = ""
            Me.txt_rbd_dig_est.Text = ""
            Me.txt_nom_est_est.Text = ""
            Me.txt_dir_est.Text = ""
            Me.txt_cel_est.Text = ""
            Me.txt_tel_est.Text = ""
            Me.txt_cor_est.Text = ""
            Me.txt_loc_est.Text = ""
            Me.txt_nom_dir_est.Text = ""
            Me.txt_rut_est.Text = ""
            Me.txt_app_est.Text = ""
            Me.txt_apm_est.Text = ""
            Me.txt_num_est.Text = ""
            Me.txt_dig_rut_est.Text = ""
Busqueda = 1
Else
    Me.btn_eli_est.Enabled = True
End If
    Me.txt_nom_est_est.SetFocus
End Sub

Private Sub dtp_fec_est_Click()
btn_ace_est.SetFocus
End Sub

Private Sub dtp_fec_est_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
btn_ace_est.SetFocus
End If
End Sub
Private Sub Form_Activate()
CentrarForma Me
End Sub
Private Sub Form_KeyPress(KeyAscii As Integer)
KeyAscii = Asc(UCase(Chr(KeyAscii)))
If KeyAscii = Asc("á") Or KeyAscii = Asc("Á") Then Exit Sub
If KeyAscii = Asc("é") Or KeyAscii = Asc("É") Then Exit Sub
If KeyAscii = Asc("í") Or KeyAscii = Asc("Í") Then Exit Sub
If KeyAscii = Asc("ó") Or KeyAscii = Asc("Ó") Then Exit Sub
If KeyAscii = Asc("ú") Or KeyAscii = Asc("Ú") Then Exit Sub
If KeyAscii = Asc("ñ") Or KeyAscii = Asc("Ñ") Then Exit Sub
If ((Chr(KeyAscii) >= "A" And Chr(KeyAscii) <= "Z") Or (Chr(KeyAscii) >= "a" And Chr(KeyAscii) <= "z")) Then Exit Sub
If (Chr(KeyAscii) >= "0" And Chr(KeyAscii) <= "9") Then Exit Sub
If KeyAscii = 8 Then Exit Sub
If KeyAscii = 13 Then Exit Sub
If KeyAscii = 32 Then Exit Sub
If KeyAscii = 37 Then Exit Sub
KeyAscii = 0


End Sub

Private Sub Form_Unload(Cancel As Integer)
Call menuhabilitado(True)
End Sub
Private Sub Form_Load()
Call menuhabilitado(False)
FORM_PAR_GLO.KeyPreview = True
Busqueda = 1
Set rs = New ADODB.Recordset

If ManTab = "parglo" Then
    FORM_PAR_GLO.Height = 6850
    FORM_PAR_GLO.Width = 10830
    FORM_PAR_GLO.frame_par_glo.Top = 240
    FORM_PAR_GLO.frame_par_glo.Left = 240
    FORM_PAR_GLO.frame_par_glo.Visible = True
    CentrarForma Me
    FORM_PAR_GLO.Show
    FORM_PAR_GLO.btn_eli_est.Enabled = False
    FORM_PAR_GLO.txt_nom_est_est.SetFocus
End If
End Sub

Private Sub lst_nom_est_DblClick()
Indi = 0
Busqueda = 0
Me.txt_nom_est_est.Text = Me.lst_nom_est.Text
a = "SELECT * FROM establecimientos where nom_EST = " & "'" & txt_nom_est_est & "'" & " order by rdb ASC"
rs.CursorLocation = adUseClient
rs.Open a, conn
If rs.RecordCount > 0 Then
    txt_rbd_est.Text = rs("RDB")
    txt_dir_est.Text = rs("DIR_EST")
    txt_tel_est.Text = rs("FON_EST")
    txt_cel_est.Text = rs("CEL_EST")
    txt_cor_est.Text = rs("MAIL_EST")
    txt_loc_est.Text = rs("LOCALIDAD_EST")
    txt_num_est.Text = rs("NUM_RES_REC_OFI_EST")
    txt_rut_est.Text = rs("RUT_DIRECTOR_EST")
    txt_dig_rut_est.Text = digito(txt_rut_est.Text)
    
    txt_app_est.Text = rs("APE_PAT_DIR")
    txt_apm_est.Text = rs("APE_MAT_DIR")
    txt_nom_dir_est.Text = rs("NOM_DIR")
    txt_rbd_dig_est.Text = rs(2)
    Me.lst_nom_est.Visible = False
    Me.Label12.Caption = "Modificando Establecimiento"
    Me.btn_eli_est.Enabled = True
    Me.txt_nom_est_est.SetFocus
    SendKeys "{end}"
End If
rs.Close
End Sub

Private Sub lst_nom_est_GotFocus()
Me.btn_ace_est.Enabled = False
End Sub

Private Sub lst_nom_est_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
 Call lst_nom_est_DblClick
End If
End Sub

Private Sub lst_nom_est_LostFocus()
Me.btn_ace_est.Enabled = True
End Sub

Private Sub txt_apm_est_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txt_num_est.SetFocus
End If
End Sub

Private Sub txt_app_est_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txt_apm_est.SetFocus
End If
End Sub

Private Sub txt_cel_est_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txt_tel_est.SetFocus
End If
End Sub

Private Sub txt_cor_est_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txt_loc_est.SetFocus
End If
End Sub

Private Sub txt_dir_est_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txt_cel_est.SetFocus
End If
End Sub

Private Sub txt_loc_est_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txt_nom_dir_est.SetFocus
End If
End Sub

Private Sub txt_nom_dir_est_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txt_rut_est.SetFocus
End If
End Sub

Private Sub txt_nom_est_est_Change()
If Busqueda = 1 Then
rs.CursorLocation = adUseClient
lst_nom_est.Clear
If Not ((Chr(KeyAscii) >= "A" And Chr(KeyAscii) <= "Z") Or (Chr(KeyAscii) >= "a" And Chr(KeyAscii) <= "z")) Then
    KeyAscii = 0
    If Me.txt_nom_est_est.Text <> "" Then
      Criterio = "'" + Me.txt_nom_est_est.Text + "%'"
      rs.Open "SELECT * FROM establecimientos where nom_est like " & Criterio & " order by rdb", conn
      lst_nom_est.Visible = False
        Me.txt_rbd_est.Text = ""
        Me.txt_dir_est.Text = ""
        If rs.RecordCount > 0 Then
        Me.Label12.Caption = ""
                        Indi = 0
            While Not rs.EOF
                lst_nom_est.AddItem rs("nom_est")
                lst_nom_est.Visible = True
                rs.MoveNext
            Wend
        Else
                Indi = 0
        End If
        rs.Close
    Else
    lst_nom_est.Visible = False
    Me.txt_rbd_est.Enabled = True
    Me.txt_rbd_est.Text = ""
    'Me.txt_dir_est.Enabled = False
    Me.txt_dir_est.Text = ""
    End If
End If
End If
End Sub

Private Sub txt_nom_est_est_KeyPress(KeyAscii As Integer)
'busqueda = 1
If KeyAscii = 27 Then
    txt_nom_est_est.Text = ""
    lst_nom_est.Visible = False
    KeyAscii = 0
ElseIf KeyAscii = 13 And Len(Trim(Me.txt_num_est.Text)) <> 0 And Busqueda = 0 Then
    Call btn_ace_est_Click
ElseIf KeyAscii = 13 And Len(Trim(Me.txt_num_est.Text)) <> 0 And Busqueda = 1 And Not valorenlista(FORM_PAR_GLO.lst_nom_est, txt_num_est.Text) Then
    Call btn_ace_est_Click

ElseIf ((Chr(KeyAscii) >= "A" And Chr(KeyAscii) <= "Z") Or (Chr(KeyAscii) >= "a" And Chr(KeyAscii) <= "z")) Then Exit Sub
ElseIf (Chr(KeyAscii) >= "0" And Chr(KeyAscii) <= "9") Then Exit Sub
ElseIf KeyAscii = 8 Then Exit Sub
ElseIf KeyAscii = 32 Then Exit Sub
ElseIf Me.txt_num_est.Text = "" Then
        If KeyAscii = 37 Then Exit Sub
End If
If KeyAscii = 13 Then
End If
End Sub

Private Sub txt_num_est_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
dtp_fec_est.SetFocus
End If
End Sub

Private Sub txt_rbd_dig_est_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txt_dir_est.SetFocus
End If
End Sub

Private Sub txt_rbd_est_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txt_rbd_dig_est.SetFocus
End If
End Sub

Private Sub txt_rut_est_KeyPress(KeyAscii As Integer)
If KeyAscii >= Asc("0") And KeyAscii <= Asc("9") Then Exit Sub
If KeyAscii = 8 Then Exit Sub
If KeyAscii = 13 Then
If IsNumeric(txt_rut_est.Text) And Len(Trim(txt_rut_est.Text)) > 6 Then
    txt_dig_rut_est.Text = digito(txt_rut_est.Text)
    txt_app_est.SetFocus
  ElseIf Len(Trim(Me.txt_rut_est.Text)) >= 1 And Len(Trim(Me.txt_rut_est.Text)) <= 6 Then
  MsgBox "ADVERTENCIA: EL RUT INGRESADO NO ES VALIDO!!", vbOKOnly, "ADVERTENCIA"
    Me.txt_dig_rut_est.Text = ""
    txt_rut_est.Text = ""
    Me.txt_rut_est.SetFocus
    SendKeys "{home}+{end}"
End If
End If
End Sub

Private Sub txt_tel_est_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txt_cor_est.SetFocus
End If
End Sub

