Hey folks i need help with the following. I've created a simple log in form in access db. It authenticates against a user table with username and password. By default all passwords have been set as "password". After user tries to login i'd like them to change their password in the event it still ='s "password" If it does then close the current form, pass the username to form two and filter only on this user name. On form two I have included form field txtbox to allow the user to update their password. Here is the code I have so far.
Here's where I need help:
1) after receiving the message to update the password close the current form,
2) pass user name as a variable to the second form
3) open 2nd form and use variable in the where clause in the record source OR use the variable to filter all records OnLoad
OnClick Event Form 1:
Private Sub Command1_Click()
If IsNull(Me.txtLoginID) Then
MsgBox "Please enter LoginID!", vbInformation, "LoginID Required"
Me.txtLoginID.SetFocus
ElseIf IsNull(Me.txtPassword) Then
MsgBox "Please enter Password!", vbInformation, "Password Required"
Me.txtPassword.SetFocus
Else
'process the job
If (IsNull(DLookup("UserLogin", "tbl_users", "UserLogin ='" & Me.txtLoginID.Value & "'"))) Or _
(IsNull(DLookup("Password", "tbl_users", "Password ='" & Me.txtPassword.Value & "'"))) Then
MsgBox "Incorrect Login or Password"
'ElseIf Me.txtPassword.Value = "password" Then
' MsgBox "Please change your password"
' DoCmd.Close
Else
DoCmd.Close
DoCmd.OpenForm "MAIN"
End If
End If
End Sub