Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

DLookup statement giving Error message

Posted on 2008-06-23
1
Medium Priority
?
289 Views
Last Modified: 2013-11-28
Access 2003-
I'm currently attempting to use the DLookup() statement on my subform for a text box called 'tbxViewPrice'.  What this statement will do is go to my 'Item' table, find the 'Price' next to the item number (ItemNmbr) and populate the associated price in each text box next to the item shown on the sub form table.  ItemNmbr is an identical name given to the subform table field that is supposed to equal the 'ItemNmbr' field from the 'Item' table (which is why the code looks the way it does below).  When I enter the code from below into the text box control source, all of the values next to each part shows '#Error' in the Price column.  I should probably mention that the 'Item' table is located on our SQL server database, and is not stored locally on my machine.
Thanks,
Ryan
=IIf(IsNull([ItemNmbr]),"",DLookUp("Price","Item","ItemNmbr = " & [ItemNmbr]))

Open in new window

0
Comment
Question by:jdol2949
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 2000 total points
ID: 21847450
please try this:
=IIf(IsNull([ItemNmbr]), 0 ,DLookUp("Price","Item","ItemNmbr = " & [ItemNmbr]))

Open in new window

0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question