problema con base de datos
Publicado por william (27 intervenciones) el 27/02/2008 18:02:51
hola amigos, tengo un programa de inventarios, pero tengo el problema que cuando comparto lo que tengo en la base de datos, no me lo reconoce, me refiero al nombre y contraseña, son usuarios por niveles y dependiendo el nivel, es el permiso, les paso el codigo.
Private Sub Command1_Click()
Dim B As Object
On Error GoTo CONTROLERRORES
Data1.Refresh
USUARIOENCONTRADO = 0
'RUTINA DE VALIDAR CAMPOS CON CAMPOS VACIOS
If Text1.Text = "" Or Text2.Text = "" Then
If Text1.Text = "" Then
mensaje = MsgBox("INTRODUZCA EL NOMBRE DEL USUARIO", vbExclamation, "POZ")
Text1.SetFocus
Exit Sub
Else
If Text2.Text = "" Then
mensaje = MsgBox("INTRODUZCA LA CONTRASEÑA DEL USUARIO", vbExclamation, "POZ")
Text2.SetFocus
Exit Sub
End If
End If
End If
'FIN DE RUTINA DE ALTA CON CAMPOS VACIOS
Data1.Recordset.MoveFirst
Data1.Recordset.MoveNext
Do
If Data1.Recordset!NOMBRE = Text1.Text And Data1.Recordset!CLAVEUSUARIO = Text2.Text Then
TIPOUSUARIO = Data1.Recordset!TIPOUSUARIO
If TIPOUSUARIO = "USUARIO NIVEL 1" Then
IBMenuNivel1.StatusBar1.Panels(3).Text = "USUARIO: " & Text1.Text
IBMenuNivel1.Show
Data1.Recordset.MoveLast
USUARIOENCONTRADO = 1
GoTo SALIDA
'Unload Me
Else
IBMenuPrincipal.StatusBar1.Panels(3).Text = "USUARIO: " & Text1.Text
IBMenuPrincipal.Show
'IBMENUPRINCIPAL
USUARIOENCONTRADO = 1
GoTo SALIDA
'Unload Me
End If
' USUARIOENCONTRADO = 0
End If
Data1.Recordset.MoveNext
Loop Until Data1.Recordset.EOF
If USUARIOENCONTRADO = 0 Then
mensaje = MsgBox("USUARIO NO VALIDO, VERIFIQUE SU NOMBRE DE USUARIO Y SU CONTRASEÑA", vbQuestion, "POZ")
Text1.SetFocus
Exit Sub
End If
CONTROLERRORES:
Select Case Err.Number
Case 91
INS = 0
mensaje = MsgBox("LA INSTALACION CONTINUA.......,", vbInformation, "INSTALACION")
IBInstalarPrimeravez.Command1.Enabled = False
INS = 1
'Unload Me
IBInstalarPrimeravez.Show vbModal, Me
If INS = 1 Then
Exit Sub
End If
Case 3044
INS = 0
mensaje = MsgBox("LA INSTALACION CONTINUA.......,", vbInformation, "INSTALACION")
IBInstalarPrimeravez.Command1.Enabled = False
INS = 1
'Unload Me
IBInstalarPrimeravez.Show vbModal, Me
If INS = 1 Then
Exit Sub
End If
Case 3024
INS = 0
mensaje = MsgBox("LA INSTALACION CONTINUA.......,", vbInformation, "INSTALACION")
IBInstalarPrimeravez.Command1.Enabled = False
INS = 1
'Unload Me
IBInstalarPrimeravez.Show vbModal, Me
If INS = 1 Then
Exit Sub
End If
'FIN DE RUTINA
End Select
SALIDA:
Unload Me
End Sub
este codigo es del boton entrar, aqui se comprueba si la contraseña y nombre de usuario son validas.
en la base de datos hay 3 campos.
nombre
tipodeusuario
clavedeusuario
aqui se hace la comparacion para saber el tipo de usuario y asi mismo darle los privilegios a cada uno, pero al darle entrar, le pongo el nombre de usuario y contraseña correctos que tengo en la base de datos, que en este caso seria el usuario nivel 1, y me marca error de nombre de usuario y contraseña, o sea se cumple la condicion que puse al ultimo y no se que este pasando, les agradeceria su ayuda.
gracias
Private Sub Command1_Click()
Dim B As Object
On Error GoTo CONTROLERRORES
Data1.Refresh
USUARIOENCONTRADO = 0
'RUTINA DE VALIDAR CAMPOS CON CAMPOS VACIOS
If Text1.Text = "" Or Text2.Text = "" Then
If Text1.Text = "" Then
mensaje = MsgBox("INTRODUZCA EL NOMBRE DEL USUARIO", vbExclamation, "POZ")
Text1.SetFocus
Exit Sub
Else
If Text2.Text = "" Then
mensaje = MsgBox("INTRODUZCA LA CONTRASEÑA DEL USUARIO", vbExclamation, "POZ")
Text2.SetFocus
Exit Sub
End If
End If
End If
'FIN DE RUTINA DE ALTA CON CAMPOS VACIOS
Data1.Recordset.MoveFirst
Data1.Recordset.MoveNext
Do
If Data1.Recordset!NOMBRE = Text1.Text And Data1.Recordset!CLAVEUSUARIO = Text2.Text Then
TIPOUSUARIO = Data1.Recordset!TIPOUSUARIO
If TIPOUSUARIO = "USUARIO NIVEL 1" Then
IBMenuNivel1.StatusBar1.Panels(3).Text = "USUARIO: " & Text1.Text
IBMenuNivel1.Show
Data1.Recordset.MoveLast
USUARIOENCONTRADO = 1
GoTo SALIDA
'Unload Me
Else
IBMenuPrincipal.StatusBar1.Panels(3).Text = "USUARIO: " & Text1.Text
IBMenuPrincipal.Show
'IBMENUPRINCIPAL
USUARIOENCONTRADO = 1
GoTo SALIDA
'Unload Me
End If
' USUARIOENCONTRADO = 0
End If
Data1.Recordset.MoveNext
Loop Until Data1.Recordset.EOF
If USUARIOENCONTRADO = 0 Then
mensaje = MsgBox("USUARIO NO VALIDO, VERIFIQUE SU NOMBRE DE USUARIO Y SU CONTRASEÑA", vbQuestion, "POZ")
Text1.SetFocus
Exit Sub
End If
CONTROLERRORES:
Select Case Err.Number
Case 91
INS = 0
mensaje = MsgBox("LA INSTALACION CONTINUA.......,", vbInformation, "INSTALACION")
IBInstalarPrimeravez.Command1.Enabled = False
INS = 1
'Unload Me
IBInstalarPrimeravez.Show vbModal, Me
If INS = 1 Then
Exit Sub
End If
Case 3044
INS = 0
mensaje = MsgBox("LA INSTALACION CONTINUA.......,", vbInformation, "INSTALACION")
IBInstalarPrimeravez.Command1.Enabled = False
INS = 1
'Unload Me
IBInstalarPrimeravez.Show vbModal, Me
If INS = 1 Then
Exit Sub
End If
Case 3024
INS = 0
mensaje = MsgBox("LA INSTALACION CONTINUA.......,", vbInformation, "INSTALACION")
IBInstalarPrimeravez.Command1.Enabled = False
INS = 1
'Unload Me
IBInstalarPrimeravez.Show vbModal, Me
If INS = 1 Then
Exit Sub
End If
'FIN DE RUTINA
End Select
SALIDA:
Unload Me
End Sub
este codigo es del boton entrar, aqui se comprueba si la contraseña y nombre de usuario son validas.
en la base de datos hay 3 campos.
nombre
tipodeusuario
clavedeusuario
aqui se hace la comparacion para saber el tipo de usuario y asi mismo darle los privilegios a cada uno, pero al darle entrar, le pongo el nombre de usuario y contraseña correctos que tengo en la base de datos, que en este caso seria el usuario nivel 1, y me marca error de nombre de usuario y contraseña, o sea se cumple la condicion que puse al ultimo y no se que este pasando, les agradeceria su ayuda.
gracias
Valora esta pregunta


0