Dlookup Where Clause

S

SAC

Access 2003

I'm attempting to use this code, but the where clause is not working:

=IIf([BillToKey]=0,[CustName],DLookUp("BillToName","qryCustomerBillto","Key="
& [BillToKey]))

This is the control source to a text control oin a report.

If I change it to Key=3, it works. [BillToKey] is a data source for a
control on the form and underlying query.

I get a blank when there is a BilltoKey number.

Thanks for your help.
 
S

SAC

I got it. I used the column property of the billto control which is a combo
box.

Thanks.
 
J

John Spencer

Is it possible that the BilltoKey is NULL and not zero?

= IIF(IsNumeric([BillToKey])=False Or BillToKey=0,[CustName]
,DLookUp("BillToName","qryCustomerBillto","Key=" & [BillToKey]))

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top