
ERROR EN CÓDIGO
Publicado por Alberto (5 intervenciones) el 14/05/2009 22:49:18
Que tal a todos nuevamnete,
Les agradezco su ayuda a Jefferson, Enrique y 2P; he intentado de una y otra forma, pero, el código no responde,
Private Sub Comando0_Click()
Dim rst As DAO.Recordset, Contador As Integer
If IsNull(Usuario) Or Usuario = "" Then Usuario.SetFocus: Exit Sub
If IsNull(Id) Or Id = "" Then Id.SetFocus: Exit Sub
Set rst = CurrentDb.OpenRecordset("SELECT Nombre usuario, Id From Usuarios Consulta Where Id Like '" & Id & "'")
If rst.EOF Then
MsgBox " El usuario no existe. ", vbInformation, " Error"
Usuario = ""
Usuario.SetFocus: Exit Sub
End If
'Aquí controlamos que se corresponda el Usuario con su Contraseña:
If rst!Id = Id And rst!Nombre_usuario = Usuario Then
rst.Close: Set rst = Nothing
DoCmd.OpenForm "Control de Clientes"
Else
MsgBox " El Id de usuario es incorrecto. ", vbInformation, " Error"
Contador = Contador + 1
If Contador = 3 Then
MsgBox "Ha intentado accesar al programa varias veces, se cancela operación.", vbCritical, "Intentos fallidos."
DoCmd.Close
Else
Usuario = ""
Usuario.SetFocus: Exit Sub
End If
End If
End Sub
Les agradezco su ayuda a Jefferson, Enrique y 2P; he intentado de una y otra forma, pero, el código no responde,
Private Sub Comando0_Click()
Dim rst As DAO.Recordset, Contador As Integer
If IsNull(Usuario) Or Usuario = "" Then Usuario.SetFocus: Exit Sub
If IsNull(Id) Or Id = "" Then Id.SetFocus: Exit Sub
Set rst = CurrentDb.OpenRecordset("SELECT Nombre usuario, Id From Usuarios Consulta Where Id Like '" & Id & "'")
If rst.EOF Then
MsgBox " El usuario no existe. ", vbInformation, " Error"
Usuario = ""
Usuario.SetFocus: Exit Sub
End If
'Aquí controlamos que se corresponda el Usuario con su Contraseña:
If rst!Id = Id And rst!Nombre_usuario = Usuario Then
rst.Close: Set rst = Nothing
DoCmd.OpenForm "Control de Clientes"
Else
MsgBox " El Id de usuario es incorrecto. ", vbInformation, " Error"
Contador = Contador + 1
If Contador = 3 Then
MsgBox "Ha intentado accesar al programa varias veces, se cancela operación.", vbCritical, "Intentos fallidos."
DoCmd.Close
Else
Usuario = ""
Usuario.SetFocus: Exit Sub
End If
End If
End Sub
Valora esta pregunta


0