Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Developer Network    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Login Change PW Form Help
Sean Sweeney 
     
4 years ago
First off I want to say what I'm trying to figure out is probably a very simple solution, probably involving modules. I just don't have much experience with modules.

My database has two back-end files - one specifically for user log-in information and permission level stuff (I haven't implemented permissions yet, but it's there for when I can figure it out).

In my database, I have it when a new user is added there is a checkbox to bring up a password change form. I'm wanting my end user to change the password on their end so I'm not actively dealing with those individuals' passwords. The hope is once they are able to change their password, I can set the "PWRest" to false so that screen won't come up after they change the password.

The coding I have for the log-in screen is as follows:
--------------------------------------
Option Compare Database
Option Explicit
Private Sub cancelbtn_Click()
On Error Resume Next
Application.Quit acQuitSaveNone
End Sub
Private Sub Form_Open(Cancel As Integer)

If CommandBars("Ribbon").Height > 100 Then
  CommandBars.ExecuteMso "MinimizeRibbon"
End If
DoCmd.RunCommand acCmdAppMaximize
DoCmd.ShowToolbar "Ribbon", acToolbarNo
End Sub
Private Sub loginbtn_Click()
Dim rs As DAO.Recordset
Dim SQL As String
Me.LBLIncorrectUserName.Visible = False
Me.LBLIncorrectPassword.Visible = False
Me.LBLBlankUserName.Visible = False
If Not IsNull(Me.TXTUserName) Then
SQL = "SELECT * FROM UserT WHERE USERNAME = '" + Me.TXTUserName.Value + "'"
Set rs = CurrentDb.OpenRecordset(SQL)
  Else
  Me.LBLBlankUserName.Visible = True
  Me.TXTUserName.SetFocus
  Exit Sub
End If
If rs.EOF Then
  Me.LBLIncorrectUserName.Visible = True
  Me.TXTUserName.SetFocus
  Exit Sub
End If
rs.MoveFirst
If (StrComp(rs("PASSWORD"), Nz(Me.TXTPassWord, ""), 0) = 0) = 0 Then
  Me.LBLIncorrectPassword.Visible = True
  Me.TXTPassWord.SetFocus
  Exit Sub
End If
rs.MoveFirst
If rs("PWRest") = True Then
  DoCmd.OpenForm "PasswordChangef"
  Exit Sub
End If
rs.MoveFirst
If rs("ActiveUser") = False Then
  Exit Sub
  End If
DoCmd.OpenForm "Menu"
DoCmd.Close acForm, Me.Name
End Sub

--------------------------------------

My very much unfinished code for the change password form is as follows:

Option Compare Database
Option Explicit
Private Sub cancelbtn_Click()
On Error Resume Next
Application.Quit acQuitSaveNone
End Sub
Private Sub cmdpasschangebtn_Click()
Dim rs As DAO.Recordset
Dim SQL As String

On Error Resume Next
If Trim(Me.TXTNewPass & "") <> Trim(Me.TXTRetype & "") Then
  MsgBox "Passwords do not Match.", vbExclamation + vbOKOnly, "Invalid Password Confirmation"
  Me.cmdpasschangebtn.Enabled = False
Else
  Me.cmdpasschangebtn.Enabled = True
If Not rs.EOF And Not rs.BOF Then
  rs.Edit
  rs("PASSWORD") = TXTRetype
  rs.Update
  rs.Close
  Set rs = Nothing
  MsgBox "Your Password has been Successfully Changed", vbInformation + vbOKOnly, "Success!"
  DoCmd.Close acForm, "PasswordChangef", acSaveNo
End If
End If
End Sub
Private Sub cmdshowpassbtn_Click()
If Not IsNull(TXTNewPass) And Not IsNull(TXTRetype) Then
  If cmdshowpassbtn.Caption = "Show Password" Then
  TXTNewPass.InputMask = ""
  TXTRetype.InputMask = ""
  cmdshowpassbtn.Caption = "Hide Password"
  ElseIf cmdshowpassbtn.Caption = "Hide Password" Then
   TXTNewPass.InputMask = "Password"
   TXTRetype.InputMask = "Password"
   cmdshowpassbtn.Caption = "Show Password"
  End If
End If
End Sub
Private Sub Form_Load()
  On Error Resume Next
  lbl_username.Caption = "Database User: " & DLookup("FIRSTNAME", "UserT", "UserID=" & USERID)
End Sub
Private Sub Form_Open(Cancel As Integer)
If CommandBars("Ribbon").Height > 100 Then
  CommandBars.ExecuteMso "MinimizeRibbon"
End If
DoCmd.RunCommand acCmdAppMaximize
DoCmd.ShowToolbar "Ribbon", acToolbarNo
End Sub
--------------------------------------

I did try a "Mod_User" Module hoping it would save USERID from the log-in but that doesn't seem to work.

Obviously, I'm missing something. I'm just kind of at a loss as to how to get it working the way I'm intending it to work

Option Compare Database
Option Explicit

Public USERID As Long
Richard Rost  @Reply  
          
4 years ago
Hi Sean. I've moved your post to the DevNet Forum. Read Rule 8 please. Thanks.
Richard Rost  @Reply  
          
4 years ago
Rule 9 too. You posted War & Peace there. :)
Kevin Robertson  @Reply  
          
4 years ago
The Security Seminar covers User Logins (and a lot more).

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Developer Network.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 6/22/2026 9:26:30 PM. PLT: 0s