DLookup Function on Subform not working

A

Alex

I am a newbie and I am having problems with DLookup on a
subform.

I am using the DLookup function to create a calculated
field on a subform that will lookup the "Total Sales
Price" of on a record in the subform after you enter
the "Item" and "Quantity." NOTE: The "Total Sales Price"
cannot be calculated using a formula, because of varying
discounts based on "Item" and "Quantity."

Anyway, my DLookup function works perfectly when I open
the subform directly and do the data-entry, but when I am
on the main Order Entry Form and the "Item Order Details"
subform is embedded in the Main Form, the DLookUp function
returns the value "#Name?".

Does anyone know how to correct this issue?
 
J

John Vinson

I am a newbie and I am having problems with DLookup on a
subform.

I am using the DLookup function to create a calculated
field on a subform that will lookup the "Total Sales
Price" of on a record in the subform after you enter
the "Item" and "Quantity." NOTE: The "Total Sales Price"
cannot be calculated using a formula, because of varying
discounts based on "Item" and "Quantity."

Anyway, my DLookup function works perfectly when I open
the subform directly and do the data-entry, but when I am
on the main Order Entry Form and the "Item Order Details"
subform is embedded in the Main Form, the DLookUp function
returns the value "#Name?".

Does anyone know how to correct this issue?

It's probably something to do with the arguments you specified in the
DLookUp - referencing a control on a Subform is tricky. You need to
use the name of the main form, and the name of the Subform Control on
that form; the name of the Form in that subform control is irrelevant.
E.g.

[Forms]![mainformname]![subformcontrol].Form![controlname]

Since you chose not to post your actual expression, I have no idea
whether this will help or not - if not, please do so!
 

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