gracias por tu ayuda, he puesto lo que me dijiste pero al fallar al ultimo intento me da un error que no se que es aqui te muestro como ha quedado el codigo
Código:
Option Compare Database
Dim Conn As ADODB.Connection
Dim rsCliente As ADODB.Recordset
Dim intento As Integer
Private Sub aceptar_click()
'MsgBox ("nombre" & nombre.Value)
Dim txtbusca, SQL, txtpass
txtbusca = login.Value
txtpass = pass.Value
SQL = "select NombrUsr from Usuario where LoginUsr='" & txtbusca & "' AND ClaveUsr='" & txtpass & "'"
Set rsCliente = Conn.Execute(SQL)
If (Not rsCliente.EOF) Then
MsgBox ("Login y password correctos. Bienvenido " & rsCliente.Fields.Item(0).Value)
DoCmd.Close acForm, "Ingreso", acSaveNo
DoCmd.OpenForm "Panel de control"
Else
MsgBox ("El login y/o password son incorrectos")
End If
intento = intento + 1
If intento >= 3 Then End
End If
End Sub
Private Sub cancelar_Click()
Form_Unload (1)
End Sub
Private Sub Comando5_Click()
End Sub
Private Sub Detalle_Click()
End Sub
Private Sub Form_Load()
'MsgBox ("ANTES declarar nada")
Set Conn = New ADODB.Connection
Set rsCliente = New ADODB.Recordset
'MsgBox ("ANTES CONECTAR PROVIDER")
Conn.Provider = "Microsoft.Jet.OLEDB.4.0"
'MsgBox ("ANTES CREAR DATASOURCE")
Conn.ConnectionString = CurrentDb.Name
'MsgBox (CurrentDb.Name)
'MsgBox Conn.State
Conn.Open
'Conn.Open
End Sub
Private Sub Form_Unload(Cancel As Integer)
Form.Visible = False
Conn.Close
'MsgBox "Hasta la próxima"
End Sub