Solved

DLookup statement giving Error message

Posted on 2008-06-23
1
282 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
1 Comment
 
LVL 142

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
If you find yourself in this situation “I have used SELECT DISTINCT but I’m getting duplicates” then I'm sorry to say you are using the wrong SQL technique as it only does one thing which is: produces whole rows that are unique. If the results you a…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
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…

920 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now