Solved

Validate Username and Password

Posted on 2009-05-19
2
343 Views
Last Modified: 2013-11-25
Can anyone send me the code to validate username and password and make the user navigate to a particualr form after successfull login or display error message for invalid credentials
and also to change password for the first time login users
help would be greatly appreciated

Thanks
Radhs
0
Comment
Question by:Radhs74
2 Comments
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
ID: 24426842
Are you using User Level Security for this? Or are you trying to roll your own security/login scheme? If ULS, then DAO has several methods available, and ULS will validate users for you. To change a user password:

DAO.NewPassword "OldPass", "NewPass"

If you're rolling your own ... that's a pretty tall order, asking for a pretty much complete validation and navigation code set. It's pretty simple to validate a user against a table:

Dim rst As DAO.Recordset
Set rst = Currentdb.OpenREcordset("SELECT * FROM YourTable Where YourUserName='" & Me.SomeTextbox & "' And YourPassword='" & Me.someOtherTextbox & "'")

If Not(rst.eof and rst.bof) then
  '/user wasn't found

Else
  '/user was found - move to a form
  DoCmd.OpenForm "SomeFormName"
End if
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question