Autor Tema: Permisos  (Leído 2077 veces)

0 Usuarios y 1 Visitante están viendo este tema.

mariano

  • Bit
  • Mensajes: 2
  • Reputación: +0/-0
    • Ver Perfil
Permisos
« en: Enero 13, 2016, 10:34:04 am »
Hola teng problema con los permisos de usuarios
 adjunto código, el mismo no me funciona
en un formulario tengo  5 check y esta asociado a 5 formularios  y/o menú
no me esta funcionando, me podrían marcar donde esta el error

Código: [Seleccionar]
Private Sub Command1_Click()
Dim RS As ADODB.Recordset
 Set RS = New ADODB.Recordset
 If Text1.Text = "" Then
MsgBox "Debes ingresar el ID del equipo", vbCritical
Exit Sub
End If
 With RS
 .ActiveConnection = "Provider=Microsoft.jet.OLEDB.4.0;Data Source=" & _
 App.Path & "\db1.mdb"
 .CursorType = adOpenStatic
 .CursorLocation = adUseClient
 .Open "Select USUARIO, PERMISO1,PERMISO2, PERMISO3,PERMISO4,PERMISO5 from CLAVE where id =" & Text1.Text

 End With

 ' cargar el Grid

 'Set MSHFlexGrid1.DataSource = RS
  '   MSHFlexGrid1.SelectionMode = flexSelectionByRow
   
    If RS.RecordCount = 0 Then
    MsgBox "RecordSet vacio, intente con otro id"
    Else
          Text2.Enabled = True
          Check1.Enabled = True
          Check2.Enabled = True
          Check3.Enabled = True
          Check4.Enabled = True
          Check5.Enabled = True
         
           
        If Not IsNull(RS.Fields.Item(0).Value) Then
            Text2.Text = RS.Fields.Item(0).Value
        End If
       
        If Not IsNull(RS.Fields.Item(2).Value) Then
           Check1.Value = RS.Fields.Item(2).Value
        End If
       
        If Not IsNull(RS.Fields.Item(3).Value) Then
             Check2.Value = RS.Fields.Item(3).Value
        End If
       
        If Not IsNull(RS.Fields.Item(4).Value) Then
             Check3.Value = RS.Fields.Item(4).Value
        End If
                 
         If Not IsNull(RS.Fields.Item(5).Value) Then
             Check4.Value = RS.Fields.Item(5).Value
        End If
     
     
   
    End If
End Sub

Private Sub Command2_Click()
Dim RS As ADODB.Recordset
Set RS = New ADODB.Recordset
 With RS
 .ActiveConnection = "Provider=Microsoft.jet.OLEDB.4.0;Data Source=" & _
 App.Path & "\db1.mdb"
 .CursorType = adOpenStatic
 .CursorLocation = adUseClient
.Open "UPDATE CLAVE SET USUARIO=" & Chr(34) & Text2.Text & Chr(34) & ", PERMISO1=" & Chr(10) & Check1.Value & Chr(10) & ", PERMISO2=" & Chr(10) & Check2.Value & Chr(10) & ", PERMISO3=" & Chr(10) & Check3.Value & Chr(10) & ", PERMISO4=" & Chr(10) & Check4.Value & Chr(10) & ", PERMISO5=" & Chr(10) & Check5.Value & Chr(10) & " Where ID = " & Text1.Text

  If permiso1 = Check1.Caption = 1 Then
    usuario = permiso1 = Principal.Agregar_Proveedor.Enabled = False
         
    Else
    usuario = permiso1 = Principal.Agregar_Proveedor.Enabled = True
   
End If


MsgBox ("Modificacion exitosa!")
 
End With
End Sub

Private Sub Form_Load()
   
    Text1.Enabled = True
    Text2.Enabled = False
    Check1.Enabled = False
    Check2.Enabled = False
    Check3.Enabled = False
    Check4.Enabled = False
    Check5.Enabled = False
   
End Sub
« última modificación: Enero 18, 2016, 09:03:15 pm por LeandroA »