Hello, I'm still learning VBA so any help will be appreciated
I'm trying to create a form to change the password on my UsingLoginT
this is the login form code:
--------
Private Sub loginYes_Click()
Dim UserLevel As Integer
If IsNull(Me.username1) Then
MsgBox "Por favor, escriba su Usuario", vbInformation, "Usuario requerido"
Me.username1.SetFocus
ElseIf IsNull(Me.password1) Then
MsgBox "Por favor, ingrese su Contraseņa", vbInformation, "Contraseņa requerida"
Me.password1.SetFocus
Else
If (IsNull(DLookup("[loginusername]", "UserLoginT", "[loginusername] ='" & Me.username1.Value & _
"' And loginpassword = '" & Me.password1.Value & "'"))) Then
MsgBox "Usuario y/o Contraseņa incorrectos"
Else
'saving login information
Dim dbsSafety As DAO.Database
Dim rstRecord As DAO.Recordset
Set dbsSafety = CurrentDb
Set rstRecord = dbsSafety.OpenRecordset("userloginrecordt")
Dim varX As String
Dim varY As String
varX = DLookup("idlogin", "UserLoginT", "Loginusername = '" & Me.username1.Value & "'")
rstRecord.AddNew
rstRecord!recordlogindate = Date
rstRecord!recordloginuser = varX
rstRecord!recordloginuserwindows = Environ$("Username")
rstRecord.Update
'Defining what kind of access will have
UserLevel = DLookup("LoginUserType", "UserLoginT", "loginusername = '" & Me.username1.Value & "'")
If Check12 = False Then
If UserLevel = 1 Then
DoCmd.Close
MsgBox "Bienvenido!!!", , "Administrador"
Else
DoCmd.Close
DoCmd.OpenForm "InicioF"
End If
Else
DoCmd.Close
DoCmd.OpenForm "loginchangepasswordf"
End If
End If
End If
End Sub
-----------------
And this is the form with the one i want to change the password
---
Private Sub Command4_Click()
If Me.Text0 = Me.Text2 And Len(Me.Text0) & "" > 0 Then
'update [loginpassword] in "UserloginT" using last record of "userloginrecordT" in field [loginid] ?????
DoCmd.Close
DoCmd.OpenForm "inicioF"
Else
MsgBox "New Password entries do not match. Re-enter ." _
& vbCrLf & "and please try again.", vbCritical, _
"Re-enter both Passwords."
End If
End Sub
thanks in advance.