AllExperts > Using MS Access 
Search      
Using MS Access
Volunteer
Answers to thousands of questions
 Home · More Using MS Access Questions · Answer Library  · Encyclopedia ·
More Using MS Access Answers
Question Library

Ask a question about Using MS Access
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Scottgem
Expertise
I can answer almost all types of questions relating to Microsoft Access usage and application design. My strengths are database and interface design.

Experience
I've been designing databases for over 15 years working with dBase, FoxPro, Approach and Access.

Organizations
Author of Microsoft Office Access 2007 VBA
Techncial Editor for Special Edition Using Microsoft Access 2007 and Access 2007 Forms, Reports & Queries From Que Publishing

 
   

You are here:  Experts > Computing/Technology > Business Software > Using MS Access > DLookup Error in Access Reports

Using MS Access - DLookup Error in Access Reports


Expert: Scottgem - 2/23/2005

Question
Hello sir,

I always get #Error message when I run a report using an unbound text box with:

=DLookUp("[Employee Info]![LastName]","[Employee Info]","[Employee Info]![ID] = Forms![Employee Details Form]![ID]")

I am using Access 97 and am trying to let the report show The Last Name of an employee given the ID only.  It works fine when I use the same expression in a form.

Please advice.

Thanks,
Enrique

Answer
It should be:

=DLookUp("[Employee Info]![LastName]","[Employee Info]","[Employee Info]![ID] = " & Forms![Employee Details Form]![ID])

The way you had it, access won't recognize the ID as a variable. hence resulting in an error. I'm assuming ID is a numeric value.

HTH
Scott<>  

Add to this Answer   Ask a Question


 
User Agreement | Privacy Policy | Kids' Privacy Policy | Help
Copyright  © 2008 About, Inc. AllExperts, AllExperts.com, and About.com are registered trademarks of About, Inc. All rights reserved.