Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 1st, 2006, 05:30 PM
Registered User
 
Join Date: Feb 2006
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Access 2000: dlookup() errors

I have a large Access database that I have been programming for the past few months. Recently I made a small addition to the program, and suddenly my custom Employee Login screen no longer works. I know for a fact that it is this form in particular because I made the database load another form on startup, and the users could open it fine.

The code for the login screen is this:

Code:
Private Sub cmdLogin_Click()
    If IsNull(cboLogin.Value) Or cboLogin.Value = "" Then
        MsgBox "Please select a login username.", vbExclamation + vbOKOnly, _
        "Lien On Me Title Services, Inc."
        cboLogin.SetFocus
        Exit Sub
    End If

    If IsNull(txtPassword.Value) Or txtPassword.Value = "" Then
        MsgBox "Please enter a password.", vbExclamation + vbOKOnly, _
        "Lien On Me Title Services, Inc."
        txtPassword.SetFocus
        Exit Sub
    End If

    If txtPassword.Value = DLookup("Password", "tblOfficeStaff", "[ID]=" & cboLogin.Value) Then
        strUsername = DLookup("Firstname", "tblOfficeStaff", "[ID]=" & cboLogin.Value) & " " & _
        DLookup("Lastname", "tblOfficeStaff", "[ID]=" & cboLogin.Value)
        DoCmd.OpenForm "frmMain"
        DoCmd.Close acForm, "frmLogin"
    Else
        MsgBox "Incorrect password!", vbCritical + vbOKOnly, _
        "Lien On Me Title Services, Inc."
        txtPassword.SetFocus
    End If
End Sub
I think dlookup() is the culprit here, because it's the only code that does any work, and this form is the only place in the entire program that uses dlookup(). It says that it creates an error log, however, I can't seem to locate where it's at.

Any help would be greatly appreciated.

Reply With Quote
  #2 (permalink)  
Old February 2nd, 2006, 11:50 AM
Friend of Wrox
 
Join Date: Dec 2005
Location: , , .
Posts: 142
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Set a breakpoint at the start and F8 step through the function if you want to find exactly where the error is occuring.

Reply With Quote
  #3 (permalink)  
Old February 7th, 2006, 08:59 AM
Friend of Wrox
Points: 4,007, Level: 26
Points: 4,007, Level: 26 Points: 4,007, Level: 26 Points: 4,007, Level: 26
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Lansing, Michigan, USA.
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

Well, if the password is a string, you need to change this everywhere:

Code:
"[ID] = " & cboLogin.Value
to

Code:
"[ID] = '" & cboLogin.Value & "'"
By the way, the .Value property can be omitted. Oh, and I LOVE this name! "Lien On Me Title Services, Inc." Too funny!


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
Reply With Quote
  #4 (permalink)  
Old February 7th, 2006, 03:32 PM
Registered User
 
Join Date: Feb 2006
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by SerranoG
 Well, if the password is a string, you need to change this everywhere:

"[ID] = " & cboLogin.Value
to
"[ID] = '" & cboLogin.Value & "'"

By the way, the .Value property can be omitted. Oh, and I LOVE this name! "Lien On Me Title Services, Inc." Too funny!
Well, for no reason and explaination, the login form is working again. I disabled it for a few days, and went to go do what you said and it worked without me having to change a thing. Go figure.

However, I did put add singlequotes for good housekeeping, thanks for the tip.

And glad you like our company's name. ;)

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
SQL Server 2000 Driver for JDBC Errors cash Java Databases 2 December 22nd, 2006 01:18 AM
SQL 2000 SERVER+ACCESS ADP DLOOKUP MHONG Access ASP 1 October 25th, 2005 08:36 AM
SQL SERVER 2000 AND ACCESS 2000 ckentebe SQL Server 2000 3 June 17th, 2004 08:50 PM
Outlook 2000 errors byron Pro VB.NET 2002/2003 3 December 1st, 2003 10:17 AM
Outlook 2000 errors byron VB.NET 2002/2003 Basics 0 August 28th, 2003 09:08 AM



All times are GMT -4. The time now is 09:20 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.