Reference field from query to an unbound txt box on form

Y

Yam84

Hello,

I would like to reference a field on a form from a query. I have
tried DLookUp as well as just the expression builder which I just
point to the field in the query, however nothing works, i continue to
get the #NAME? error

Here is the query:
SELECT AcqDetailQuery.ProductID, AcqDetailQuery.SumOfstockQuantity,
([AcqDetailQuery].[SumOfstockQuantity]-[AmtCheckedOut]) AS AOH,
NZ(TTLCheckedOut.SumCheckedOut,0) AS AmtCheckedOut,
Nz(TTLCheckedIn.SumCheckedIn,0) AS AmtCheckedIn
FROM (AcqDetailQuery LEFT JOIN (SELECT productID, Sum([qtycheckedout])
AS SumCheckedOut
FROM CheckedOutQry
WHERE PurchasetypeID <=3
GROUP BY ProductID) AS TTLCheckedOut ON AcqDetailQuery.ProductID =
TTLCheckedOut.ProductID) LEFT JOIN (SELECT ProductID,
Sum([qtycheckedin]) AS SumCheckedIN
FROM checkInQry
WHERE PurchasetypeID = 4
GROUP BY ProductID) AS TTLCheckedIn ON AcqDetailQuery.ProductID =
TTLCheckedIn.ProductID;


I have tried the following in the control source of the unbound text
box:
=[AOHQry]![AOH]
=DLookUp("[AOH]","AOHQry")

This qry calculates the amount on hand for each product. I would like
to reference this number each time an item is checked out.
 

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