You are here:

Using MS Access/DLookup Error in Access Reports

Advertisement


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<>  

Using MS Access

All Answers


Answers by Expert:


Ask Experts

Volunteer


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

©2012 About.com, a part of The New York Times Company. All rights reserved.