?
Solved

Validate Username and Password

Posted on 2009-05-19
2
Medium Priority
?
347 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 85

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 2000 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

10 Questions to Ask when Buying Backup Software

Choosing the right backup solution for your organization can be a daunting task. To make the selection process easier, ask solution providers these 10 key questions.

Question has a verified solution.

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

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month14 days, 22 hours left to enroll

771 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