DLookup

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I have an expression of DLookup as following:
=DLookUp("[Address]","Destination","[DestinationID]=" & [Forms]![Orders1]![cmbDestinationID].Column(0))
where DestinationID in table Destination is an auto number.
when i run it, it says "#Error"
what is wrong with it?

appreciate your help!

Goodman
 
Goodman,

I can't really tell you why, but I have found out from experience that the
syntax of domain aggregate functions can be tricky, in that it tends to
change from one object type to another, as regards the inclusion of the
condition value in the quotes; It might well be that you change it to:
=DLookUp("[Address]","Destination","[DestinationID]=
[Forms]![Orders1]![cmbDestinationID].Column(0)")
(i.e. include the condtn value in the quotes) and you find it works! Not
guaranteed, but give it a shot.

HTH,
Nikos
 
Hi,
I have an expression of DLookup as following:
=DLookUp("[Address]","Destination","[DestinationID]=" & [Forms]![Orders1]![cmbDestinationID].Column(0))
where DestinationID in table Destination is an auto number.
when i run it, it says "#Error"
what is wrong with it?

appreciate your help!

Goodman

What is the NAME of this control.
It cannot be the same as the name of any field used in it's control
source expression. So if the control name is "Address" change it to
"AAddress". When writing an expression into a control, it's always
best to start with an Unbound control, rather than using a bound
control and changing it's control source.

If the form on which this control is placed is "Orders1" and the bound
column [of cmbDestinationID] is the first column (column0), you can
tighten up the code considerably.

=DLookUp("[Address]","Destination","[DestinationID]=" &
Me![cmbDestinationID])

No need to use the forms!FormName syntax nor to specify the column.
 
Back
Top