Help with DLookUp on subform

S

Steve Perrins

I have a field in a sub form that I need to fill with data from another
table on the same database.
The main form is called enquiry and the sub form is called child0 (sales_enq
is the actual form name).

In the control source for the field I need to fill I have tried the
following:-

=DLookUp("name","[developments]","[ID] =
[Forms]![enquiry]![child0]![DEVID]") produces a blank field, i.e. no
results.

=DLookUp("name","[developments]","[ID] =
[Forms]![enquiry]![child0].[DEVID]") produces #ERROR

The field DEVID on the subform does have a value in it.
The sub form is a list of records.

Where am I going wrong?

Thanks,

Steve Perrins.
 
S

Steve Perrins

Just as a bit more information if I hard code the ID value I want in the
DLookUp it works,
e.g. =DLookUp("name","[developments]","[ID] =1")

Thanks,

Steve
 
S

Steve Perrins

Found the answer, because the the control that contains the expression is on
the same subform as the control I ame getting the WHERE value from I can
just specify the control name without any of the form references :-

=DLookUp("name","[developments]","[ID] = [DEVID]")

Regards,

Steve Perrins
 

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

Top