Link to home
Start Free TrialLog in
Avatar of jdol2949
jdol2949Flag for United States of America

asked on

DLookup statement giving Error message

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

ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial