We help IT Professionals succeed at work.

#Error on a report

SteveL13
SteveL13 asked
on
33 Views
Last Modified: 2016-04-20
I'm getting #Error on a report.  Here is the control for the text field...

=DLookUp("[Initials]","tblEmployees","[EmployeeID] = " & [Reports]![rptTaskCard].[Report].[subrptTaskCardDetails]![cboMech])

How do I hide the #Error if there is no value in the DLookup?
Comment
Watch Question

Try

=IIF(ISERROR(DLookUp("[Initials]","tblEmployees","[EmployeeID] = " & [Reports]![rptTaskCard].[Report].[subrptTaskCardDetails]![cboMech])),"",DLookUp("[Initials]","tblEmployees","[EmployeeID] = " & [Reports]![rptTaskCard].[Report].[subrptTaskCardDetails]![cboMech]))
CERTIFIED EXPERT
Most Valuable Expert 2015
Distinguished Expert 2018
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
First suggestion still gave me #Error.

2nd suggestion did work.
CERTIFIED EXPERT
Most Valuable Expert 2015
Distinguished Expert 2018

Commented:
That's because IIf() evaluates both the true expression and the false expression before determining which one to use. Thus it cannot be used in situations like this.

/gustav
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.