?
Solved

How do I Validate a password entered in an Access 2003 Form with AD

Posted on 2009-05-04
5
Medium Priority
?
316 Views
Last Modified: 2013-11-28
I have an Access 2003 DB Front-end with MS SQL 2005 Back-end.  Some of our shop users login to their PCs using a common "Shop" account.  They also have a "Personal" account for accessing MS Exchange e-mail using OWA so do have a personal AD account.

When these users open Access I wish them to "Login" using their normal AD Username & Password.

Any hints/code how I can achieve this?
0
Comment
Question by:CABHugh
[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
  • 3
  • 2
5 Comments
 
LVL 22

Expert Comment

by:Paka
ID: 24302401
Are you shop owners on a common domain or are they accessing the Access/SQL through web app?
0
 

Author Comment

by:CABHugh
ID: 24302611
They are connectiong to a RDP session on Terminal Servers in our Data Centre.  They then open the Access 2003 Front-end in the session.  Each Receptionist in the Shop, up to 4, uses a common login for access but I wish Access to record the actual individual using that session.  As I've said, they do all have personal accounts as well so it would be easier for me to make use to that username and password rather than creating new passwords just for the DB which would be hard to maintain going forward.
0
 
LVL 22

Expert Comment

by:Paka
ID: 24302758
What kind of PCs do they have?  Would you be able to copy the Access front end to them and have the users log in using their AD accounts?   In this way, you would be able to integrated SQL authentication to enforce the security and auditing...
0
 

Author Comment

by:CABHugh
ID: 24302782
Not possible.  They are using TS over a ADSL VPN (Slow).  Everything runs on servers in the same datacentre so we get good local speed there.  I would like to open a login screen when Access opens and ask them to enter their personal AD Username & Password.  Im sure ther must then be a way, in VBA, to authenticate the credentials with AD.  If the authentication failed then the form would Quit the Access DB.

I just need that bit of VBA!!!
0
 

Accepted Solution

by:
CABHugh earned 0 total points
ID: 24305236
OK - I've got it working.

I have used the code here to query the AD with the Username & Password enterd in my Login Form.
If AD returns an error then the Credentials supplied are incorrect.  I give them 3 chances at enetering the correct data then Quit the DB.
Private Sub cmdLogin_Click()
On Error GoTo Err_Login
Dim strAuthUser As String
Dim strAuthPassword As String
Dim strAuthOUPath As String
Dim intRemain As Integer
Dim txtRemain As String
 
strAuthUser = Me.txtUser
strAuthPassword = Me.txtPassword
strAuthOUPath = "OU=ZZZ, OU=XXX"
Set oRoot = GetObject("LDAP:")
Set oOU = oRoot.OpenDSObject("LDAP://dc=YYY, dc=COM", "cn=" & strAuthUser & ", " & strAuthOUPath, strAuthPassword, ADS_SECURE_AUTHENTICATION)
 
Exit_Login:
    MsgBox "Login successful - Welcome", vbInformation, "Success..."
    CredentialsOK = True
    DoCmd.Close
    Exit Sub
 
Err_Login:
    If LoginAttempts = 3 Then GoTo Err_Login_Quit
    intRemain = 3 - LoginAttempts
    If intRemain = 1 Then
        txtRemain = " attempt remaining."
    Else
        txtRemain = " attempts remaining."
    End If
    MsgBox "Login Failed." & vbCrLf & vbLf & intRemain & txtRemain, vbCritical, "Failed..."
    Me.txtUser = ""
    Me.txtPassword = ""
    Me.txtUser.SetFocus
    LoginAttempts = LoginAttempts + 1
    Exit Sub
 
Err_Login_Quit:
    MsgBox "Login Failed.  Access denied.  Please contact Helpdesk for assistance.", vbCritical, "Quit..."
    DoCmd.Quit acQuitSaveNone
    Exit Sub
    
End Sub

Open in new window

0

Featured Post

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Recently, Microsoft released a best-practice guide for securing Active Directory. It's a whopping 300+ pages long. Those of us tasked with securing our company’s databases and systems would, ideally, have time to devote to learning the ins and outs…
Here's a look at newsworthy articles and community happenings during the last month.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Suggested Courses
Course of the Month9 days, 13 hours left to enroll

762 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