Wrox Programmer Forums
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 2nd, 2013, 11:53 AM
Registered User
 
Join Date: Jul 2013
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default DLookup Complications

I'm trying to get a log in form to work in Access... this specific log in needs to be able to recognize whether or not someone has Admin rights. Here's the code:

Code:
Private Sub SubUserPass_Click()

' On Error GoTo Error_Handler

Dim TblPers As TableDef
Dim Username As String
Dim Password As String
Dim Admin As Integer
Dim LogInUsername As String
Dim LogInPassword As String
Dim DLookUsername As String
Dim DLookPassword As String
Dim Error_Handler As Integer

DLookUsername = DLookup("[Username]", "TblPers", "[Admin] = -1")
DLookPassword = DLookup("[Password]", "TblPers")

If Me.LogInUsername.Value = DLookUsername And Me.LogInPassword.Value = DLookPassword Then
    DoCmd.OpenForm "FrmAddEdit"
    DoCmd.Close acForm, "FrmAdminUserPass"
    Exit Sub
Else
    ' GoTo Error_Handler
    Exit Sub
End If

' Error_Handler:
' Error_Handler = MsgBox("You do not have access to this application.", vbOKOnly, "Access Not Granted")
' Exit Sub

End Sub
Help? It's doing absolutely nothing when I click on the button...

Last edited by vpete254; August 2nd, 2013 at 12:05 PM..





Similar Threads
Thread Thread Starter Forum Replies Last Post
dlookup help please STEFFANI Access VBA 1 February 4th, 2012 12:55 PM
DLookup Help jchristadore Access 3 February 20th, 2009 08:55 AM
Dlookup and variables Jaqx Access 3 September 29th, 2006 06:47 AM
Help with DLookup Devilboy13 Access VBA 4 August 30th, 2006 02:48 PM
DLookup Teqlump Access VBA 1 August 9th, 2006 11:48 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.