Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   Seminars   Templates   TechHelp   Fast Tips   Forums   Help   Contact   Join   Order   Logon  
 
Home > Help > AccessDev.NET >
AccessDev.NET AccessDev.NET


Back to AccessDev.NET
 

Login Change PW Form Help Upload Images   Link  
Sean Sweeney 
2 months 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
2 months ago
Hi Sean. I've moved your post to the DevNet Forum. Read Rule 8 please. Thanks.
Richard Rost
2 months ago
Rule 9 too. You posted War & Peace there. :)
Kevin Robertson
2 months 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, below.
 


Back to AccessDev.NET Comments
 

Start a NEW Conversation
 
Only students may post right now. Click here for more information on how you can set up an account. If you are a student, please LOG ON first.
 
Subscribe
 

Check out these other pages that may be of interest to you:

9/27/2022Report Border
9/26/2022First Day of Month
9/23/2022Before Update
9/22/2022Synchronize Subforms
9/21/2022InputBox
9/20/2022Link Master Fields
9/19/2022DateSerial
9/18/2022Sequential Annual Coding
9/16/2022Scope
9/15/2022Resize Forms
 
 
The following is a paid advertisement banner. They are used to support the site.
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
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
amicron@gmail.com
Blog RSS Feed    Twitter

YouTube Channel    LinkedIn