DLookup

G

Goodman

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
 
N

Nikos Yannacopoulos

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
 
F

fredg

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.
 

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