Whats up people!
Ok I've been fighting this login script for awhile. Some of you have helped me out a lot and I am extremely grateful. I am close to finishing this thing I can feel it. Here's what I have so far.
Option Compare Database
Option Explicit
Private Sub Update_Click()
Dim Passwords As String
Dim DateUpdated As Date
Dim ExpiredDate As Date
Dim dbs As DAO.Database
Dim Users As DAO.Database
Dim usrLogin As TextBox
Dim loginID(7) As String
loginID(1) = "dgrant"
loginID(2) = "yalvarez"
loginID(3) = "belbrecht"
loginID(4) = "dgarcia"
loginID(5) = "ddepuydt"
loginID(6) = "jllera"
loginID(7) = "kabler"
Set dbs = CurrentDb
'Check to see if data is entered into the OldPassword text box
If IsNull(Me.OldPassword.Value) = True Then
MsgBox "Please enter Old Password", vbInformation, "Old Password Required"
Me.OldPassword.SetFocus
Exit Sub
End If
If Me.OldPassword.Value = DLookup("Passwords", "Users") Then
dbs.Execute "Update Users Set (DateUpdated = '" & CStr(Now()) & "', Where loginID() = '" & usrLogin.Text & "'"
dbs.Execute "Update Users Set (ExpiredDate = '" & CStr(Now()) & "', Where loginID() = '" & usrLogin.Text & "'"
Exit Sub
End If
'Check to see if data is entered into the NewPassword text box
If IsNull(Me.NewPassword.Value) = True Then
MsgBox "Please enter New Password", vbInformation, "New Password Required"
Me.NewPassword.SetFocus
Exit Sub
End If
'Check to see if data is entered into the ConfirmPassword text box
If IsNull(Me.ConfirmPassword.Value) = True Then
MsgBox "Please confirm password", vbInformation, "Confirmation Required"
Me.ConfirmPassword.SetFocus
Exit Sub
End If
If Me.ConfirmPassword.Value = Me.NewPassword.Value Then
'Do what you normally do
Else
MsgBox "Password does not match", vbCritical, "ERROR"
End If
If Len(Me.NewPassword.Value) > 0 Then
dbs.Execute "Update Users Set(Passwords = '" & Me.NewPassword.Value & "') Where loginID() = '" & usrLogin.Text & "'"
End If
End Sub
The blue is where it is giving me a debug error. I know that the if statement just checks to see if something is written in the text box but I didn't really how else to write it out. Can some please help me with this? thanks guys and gals..