gracias, como declaro la variable como publica
lo hice de la sig. manera
Public intento As Integer
pero me da el sig. error
se ha producido el error 91 en tiempo de ejecucion variable objeto o bloque With no establecido y me señala una linea del codigo
Código:
Option Compare Database
Dim Conn As ADODB.Connection
Public intento As Integer
Dim rsCliente As ADODB.Recordset
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")
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