Solved

DLookup statement giving Error message

Posted on 2008-06-23
1
285 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 500 total points
ID: 21847450
please try this:
=IIf(IsNull([ItemNmbr]), 0 ,DLookUp("Price","Item","ItemNmbr = " & [ItemNmbr]))

Open in new window

0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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.
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

762 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