Pessoal, alguem consegue achar o problema abaixo?
Tabela TBLUsers
User Senha NivelSeguranca
Joao 1234 1
cx texto Login - txtUser
cx texto Senha - txtSenha
Botao Entrar - cmdEntrar
Private Sub cmdEntrar_Click()
Dim Identificacao As Integer
If Me.txtSenha.Value = DLookup("[Senha]", "[TBLUsers]", "[User] = '" & Me.txtUser & "'") Then
Identificacao = DLookup("[NivelSeguranca]", "[TBLUsers", "[User] = '" & Me.TxtUser & "'")
Select Case Identificacao
Case 1
stDocName = "formularioinicial"
Case 2
stDocName = "formulariofinal"
End Select
DoCmd.Close
DoCmd.OpenForm stDocName
Else
MsgBox "Senha Incorreta, digite novamente a senha.", vbInformation + vbOKOnly, "Erro"
Me.txtSenha.Value = ""
Exit Sub
End If
End Sub
Private Sub Detail_Click()
End Sub
Private Sub Form_Open(Cancel As Integer)
End Sub
Private Sub txtSenha_BeforeUpdate(Cancel As Integer)
End Sub
Private Sub txtUser_AfterUpdate()
Me.txtSenha.SetFocus
End Sub
Private Sub txtUser_BeforeUpdate(Cancel As Integer)
End Sub
*** ESSA ROTINA FUNCIONA PERFEITAMENTE ****
O PROBLEMA
Tentei repetir o mesmo codigo para criar uma segunda situação onde depois de logado, para acessar um determinado formulario, o sistema ira pedir uma nova senha, e fiz os seguintes ajustes:
Tabela TBLUsers2
User Senha NivelSeguranca
Joao 5678 1
cx texto Login - txtUser2
cx texto Senha - txtSenha2
Botao Entrar - cmdEntrar2
Private Sub cmdEntrar_Click()
Dim Identificacao As Integer
If Me.txtSenha.Value = DLookup("[Senha]", "]TBLUsers]", "[User] = '" & Me.txtUser2 & "'") Then
Identificacao = DLookup("[NivelSeguranca]", "]TBLUsers]", "[User] = '" & Me.txtUser2 & "'")
Select Case Identificacao
Case 1
stDocName = "formulariogerencial"
Case 2
stDocName = "formulariofinal"
End Select
DoCmd.Close
DoCmd.OpenForm stDocName
Else
MsgBox "Senha Incorreta, digite novamente a senha.", vbInformation + vbOKOnly, "Erro"
Me.txtSenha2.Value = ""
Exit Sub
End If
End Sub
Private Sub Detail_Click()
End Sub
Private Sub Form_Open(Cancel As Integer)
End Sub
Private Sub txtSenha_BeforeUpdate(Cancel As Integer)
End Sub
Private Sub txtUser_AfterUpdate()
Me.txtSenha.SetFocus
End Sub
Private Sub txtUser_BeforeUpdate(Cancel As Integer)
End Sub
OBS: QUANDO EXECUTO O SEGUNDO LOGIN, O SISTEMA NAO ENCONTRA A TABELA. ALGUEM SABE COMO POSSO RESOLVER ISSO?
Tabela TBLUsers
User Senha NivelSeguranca
Joao 1234 1
cx texto Login - txtUser
cx texto Senha - txtSenha
Botao Entrar - cmdEntrar
Private Sub cmdEntrar_Click()
Dim Identificacao As Integer
If Me.txtSenha.Value = DLookup("[Senha]", "[TBLUsers]", "[User] = '" & Me.txtUser & "'") Then
Identificacao = DLookup("[NivelSeguranca]", "[TBLUsers", "[User] = '" & Me.TxtUser & "'")
Select Case Identificacao
Case 1
stDocName = "formularioinicial"
Case 2
stDocName = "formulariofinal"
End Select
DoCmd.Close
DoCmd.OpenForm stDocName
Else
MsgBox "Senha Incorreta, digite novamente a senha.", vbInformation + vbOKOnly, "Erro"
Me.txtSenha.Value = ""
Exit Sub
End If
End Sub
Private Sub Detail_Click()
End Sub
Private Sub Form_Open(Cancel As Integer)
End Sub
Private Sub txtSenha_BeforeUpdate(Cancel As Integer)
End Sub
Private Sub txtUser_AfterUpdate()
Me.txtSenha.SetFocus
End Sub
Private Sub txtUser_BeforeUpdate(Cancel As Integer)
End Sub
*** ESSA ROTINA FUNCIONA PERFEITAMENTE ****
O PROBLEMA
Tentei repetir o mesmo codigo para criar uma segunda situação onde depois de logado, para acessar um determinado formulario, o sistema ira pedir uma nova senha, e fiz os seguintes ajustes:
Tabela TBLUsers2
User Senha NivelSeguranca
Joao 5678 1
cx texto Login - txtUser2
cx texto Senha - txtSenha2
Botao Entrar - cmdEntrar2
Private Sub cmdEntrar_Click()
Dim Identificacao As Integer
If Me.txtSenha.Value = DLookup("[Senha]", "]TBLUsers]", "[User] = '" & Me.txtUser2 & "'") Then
Identificacao = DLookup("[NivelSeguranca]", "]TBLUsers]", "[User] = '" & Me.txtUser2 & "'")
Select Case Identificacao
Case 1
stDocName = "formulariogerencial"
Case 2
stDocName = "formulariofinal"
End Select
DoCmd.Close
DoCmd.OpenForm stDocName
Else
MsgBox "Senha Incorreta, digite novamente a senha.", vbInformation + vbOKOnly, "Erro"
Me.txtSenha2.Value = ""
Exit Sub
End If
End Sub
Private Sub Detail_Click()
End Sub
Private Sub Form_Open(Cancel As Integer)
End Sub
Private Sub txtSenha_BeforeUpdate(Cancel As Integer)
End Sub
Private Sub txtUser_AfterUpdate()
Me.txtSenha.SetFocus
End Sub
Private Sub txtUser_BeforeUpdate(Cancel As Integer)
End Sub
OBS: QUANDO EXECUTO O SEGUNDO LOGIN, O SISTEMA NAO ENCONTRA A TABELA. ALGUEM SABE COMO POSSO RESOLVER ISSO?