Dlookup Where Clause

  • Thread starter Thread starter SAC
  • Start date Start date
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.
 
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
 
Back
Top