Solved

DLookup statement giving Error message

Posted on 2008-06-23
1
281 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
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…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

708 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

13 Experts available now in Live!

Get 1:1 Help Now