Avatar of SteveL13
SteveL13Flag for United States of America

asked on 

#Error on a report

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?
Microsoft Access

Avatar of undefined
Last Comment
Gustav Brock
Avatar of Uptime Legal Systems
Uptime Legal Systems
Flag of United States of America image

Try

=IIF(ISERROR(DLookUp("[Initials]","tblEmployees","[EmployeeID] = " & [Reports]![rptTaskCard].[Report].[subrptTaskCardDetails]![cboMech])),"",DLookUp("[Initials]","tblEmployees","[EmployeeID] = " & [Reports]![rptTaskCard].[Report].[subrptTaskCardDetails]![cboMech]))
ASKER CERTIFIED SOLUTION
Avatar of Gustav Brock
Gustav Brock
Flag of Denmark image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of SteveL13
SteveL13
Flag of United States of America image

ASKER

First suggestion still gave me #Error.

2nd suggestion did work.
Avatar of Gustav Brock
Gustav Brock
Flag of Denmark image

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

Microsoft Access is a rapid application development (RAD) relational database tool. Access can be used for both desktop and web-based applications, and uses VBA (Visual Basic for Applications) as its coding language.

226K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo